<div dir="ltr"><div><div><div><div>I fail to see the wtf.<br></div><div><br></div>flags = a.flags<br><br></div>So, "flags" at this point is just an alias to "a.flags", just like any other variable in python<br><br></div>"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.<br><br></div>Ben Root<br><div><br><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Mar 25, 2015 at 4:36 PM, Jaime Fernández del Río <span dir="ltr"><<a href="mailto:jaime.frio@gmail.com" target="_blank">jaime.frio@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><br></div><div><div><font face="monospace, monospace">>>> import numpy as np</font></div><div><font face="monospace, monospace">>>> a = np.arange(10)</font></div><div><font face="monospace, monospace">>>> flags = a.flags</font></div><div><font face="monospace, monospace">>>> flags</font></div><div><font face="monospace, monospace">  C_CONTIGUOUS : True</font></div><div><font face="monospace, monospace">  F_CONTIGUOUS : True</font></div><div><font face="monospace, monospace">  OWNDATA : True</font></div><div><font face="monospace, monospace">  WRITEABLE : True</font></div><div><font face="monospace, monospace">  ALIGNED : True</font></div><div><font face="monospace, monospace">  UPDATEIFCOPY : False</font></div><div><font face="monospace, monospace">>>> flags.writeable = False</font></div><div><font face="monospace, monospace">>>> a.flags</font></div><div><font face="monospace, monospace">  C_CONTIGUOUS : True</font></div><div><font face="monospace, monospace">  F_CONTIGUOUS : True</font></div><div><font face="monospace, monospace">  OWNDATA : True</font></div><div><font face="monospace, monospace">  WRITEABLE : False  <--- WTF!!??</font></div><div><font face="monospace, monospace">  ALIGNED : True</font></div><div><font face="monospace, monospace">  UPDATEIFCOPY : False</font></div></div><div><br></div><div>I understand why this is happening, and that there is no other obvious way to make</div><div><br></div><div><font face="monospace, monospace">a.flags.writeable = False</font></div><div><br></div><div>work than to have the return of <font face="monospace, monospace">a.flags</font> linked to <font face="monospace, monospace">a</font> under the hood.<br></div><div><br></div><div>But I don't think this is documented anywhere, and wonder if perhaps it should.</div><span><font color="#888888"><div><br></div><div>Jaime</div><div><br></div>-- <br><div>(\__/)<br>( O.o)<br>( > <) Este es Conejo. Copia a Conejo en tu firma y ayúdale en sus planes de dominación mundial.</div>
</font></span></div>
<br>_______________________________________________<br>
NumPy-Discussion mailing list<br>
<a href="mailto:NumPy-Discussion@scipy.org" target="_blank">NumPy-Discussion@scipy.org</a><br>
<a href="http://mail.scipy.org/mailman/listinfo/numpy-discussion" target="_blank">http://mail.scipy.org/mailman/listinfo/numpy-discussion</a><br>
<br></blockquote></div><br></div></div>