[Numpy-discussion] Non-writeable default for numpy.ndarray
Francesc Altet
faltet at carabos.com
Fri Sep 29 11:23:26 EDT 2006
Hello,
Is the next a bug a feature?
In [102]: f4=numpy.ndarray(buffer="a\x00b"*4, dtype="f4", shape=3)
In [103]: f4
Out[103]: array([ 2.60561966e+20, 8.94319890e-39, 5.92050103e+20],
dtype=float32)
In [104]: f4[2] = 2
---------------------------------------------------------------------------
<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 = True
In [106]: f4[2] = 2
In [107]: f4
Out[107]: array([ 2.60561966e+20, 8.94319890e-39, 2.00000000e+00],
dtype=float32)
i.e. in an array built from ndarray, the default is that it has to be
read-only?
--
>0,0< Francesc Altet http://www.carabos.com/
V V Cárabos Coop. V. Enjoy Data
"-"
More information about the NumPy-Discussion
mailing list