[Numpy-discussion] Do you find this behavior surprising?
Jaime Fernández del Río
jaime.frio at gmail.com
Wed Mar 25 16:36:59 EDT 2015
>>> import numpy as np
>>> a = np.arange(10)
>>> flags = a.flags
>>> flags
C_CONTIGUOUS : True
F_CONTIGUOUS : True
OWNDATA : True
WRITEABLE : True
ALIGNED : True
UPDATEIFCOPY : False
>>> flags.writeable = False
>>> a.flags
C_CONTIGUOUS : True
F_CONTIGUOUS : True
OWNDATA : True
WRITEABLE : False <--- WTF!!??
ALIGNED : True
UPDATEIFCOPY : False
I understand why this is happening, and that there is no other obvious way
to make
a.flags.writeable = False
work than to have the return of a.flags linked to a under the hood.
But I don't think this is documented anywhere, and wonder if perhaps it
should.
Jaime
--
(\__/)
( O.o)
( > <) Este es Conejo. Copia a Conejo en tu firma y ayúdale en sus planes
de dominación mundial.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20150325/09bc5a7f/attachment.html>
More information about the NumPy-Discussion
mailing list