[Numpy-discussion] Setting WRITEABLE flag on array scalar

Timothy Hochberg tim.hochberg@ieee....
Thu Jan 10 10:13:36 CST 2008

On Jan 10, 2008 8:53 AM, Stefan van der Walt <stefan@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@ieee.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/numpy-discussion/attachments/20080110/b9b025f8/attachment-0001.html 

More information about the Numpy-discussion mailing list