[Numpy-discussion] Setting WRITEABLE flag on array scalar
Travis E. Oliphant
Thu Jan 10 10:21:28 CST 2008
Stefan van der Walt 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?
You can't do it, because there is no place for the information to go.
The array scalars are always read-only anyway. So, there should be no
reason to set this flag.
More information about the Numpy-discussion