From: Stefan v. d. W. <st...@su...> - 2006-10-20 13:22:53
|
On Fri, Oct 20, 2006 at 11:42:26AM +0200, Sebastien Bardeau wrote: > >>> a =3D numpy.array((1,2,3)) > >>> b =3D a[:2] Here you index by a slice. > >>> c =3D a[2] Whereas here you index by a scalar. So you want to do b =3D a[[2]] b +=3D 1 or in the general case b =3D a[slice(2,3)] b +=3D 1 Regards St=E9fan |