I fail to see the wtf. flags = a.flags
So, "flags" at this point is just an alias to "a.flags", just like any other variable in python "flags.writeable = False" would then be equivalent to "a.flags.writeable = False". There is nothing numpy-specific here. a.flags is mutable object. This is how Python works. Ben Root On Wed, Mar 25, 2015 at 4:36 PM, Jaime Fernández del Río < jaime.f...@gmail.com> wrote: > > >>> 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. > > _______________________________________________ > NumPy-Discussion mailing list > NumPy-Discussion@scipy.org > http://mail.scipy.org/mailman/listinfo/numpy-discussion > >
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion