From: Francesc A. <fa...@ca...> - 2006-09-29 15:23:33
|
Hello, Is the next a bug a feature? In [102]: f4=3Dnumpy.ndarray(buffer=3D"a\x00b"*4, dtype=3D"f4", shape=3D3) In [103]: f4 Out[103]: array([ 2.60561966e+20, 8.94319890e-39, 5.92050103e+20],=20 dtype=3Dfloat32) In [104]: f4[2] =3D 2 =2D------------------------------------------------------------------------= =2D- <type 'exceptions.RuntimeError'> Traceback (most recent call last) /home/faltet/python.nobackup/numpy/<ipython console> in <module>() <type 'exceptions.RuntimeError'>: array is not writeable In [105]: f4.flags.writeable =3D True In [106]: f4[2] =3D 2 In [107]: f4 Out[107]: array([ 2.60561966e+20, 8.94319890e-39, 2.00000000e+00],=20 dtype=3Dfloat32) i.e. in an array built from ndarray, the default is that it has to be=20 read-only? =2D-=20 >0,0< Francesc Altet =A0 =A0 http://www.carabos.com/ V V C=E1rabos Coop. V. =A0=A0Enjoy Data "-" |