[Numpy-discussion] Setting WRITEABLE flag on array scalar

Stefan van der Walt stefan at sun.ac.za
Thu Jan 10 10:53:59 EST 2008


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?

Thanks for any feedback.

Stéfan



More information about the NumPy-Discussion mailing list