Re: [Numpy-discussion] Setting WRITEABLE flag on array scalar
On Jan 10, 2008 8:53 AM, Stefan van der Walt [EMAIL PROTECTED] 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. -- . __ . |-\ . . [EMAIL PROTECTED] ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] Setting WRITEABLE flag on array scalar
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. -Travis O. ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] Setting WRITEABLE flag on array scalar
Hi, On Thu, Jan 10, 2008 at 10:21:28AM -0600, Travis E. Oliphant wrote: 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. Right, I was confused because I saw: In [1]: x = N.bool_(3) In [2]: x Out[2]: True In [3]: x += 1 In [4]: x Out[4]: 2 But now I see that iadd does not actually change the original value. Thanks Stéfan ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion