[Numpy-discussion] Setting WRITEABLE flag on array scalar

Timothy Hochberg tim.hochberg at ieee.org
Thu Jan 10 11:13:36 EST 2008


On Jan 10, 2008 8:53 AM, Stefan van der Walt <stefan at sun.ac.za> wrote:

> Hi all,
>
> We currently use an array scalar of value False as the mask in
> MaskedArray.  I would like to make sure that the mask value cannot be
> modified, but when I try
>
> import numpy as np
> x = np.bool_(False)
> x.flags['WRITEABLE'] = False
>
> I am warned that you "Cannot set flags on array scalars.".  Is there
> any reason why this is prohibited?  Which is the best way around it?


When I try this, the WRITEABLE flag is False to begin with. Are you seeing
it as True? If not it wouldn't seem like there's any reason to do anything
in your case.



-- 
.  __
.   |-\
.
.  tim.hochberg at ieee.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20080110/b9b025f8/attachment.html>


More information about the NumPy-Discussion mailing list