> With the new implementation, the data is not shared for any of the 3 > variations above.
The 'copy=True' in MaskedArray.__new__ ensures that data is always copied by default (that's the way I liked it). Most methods that return new masked arrays (__getitem__ and __setitem__, for example) do not specifically use a particular value of this flag, they just rely on the default, "copy=True" , which is "don't share". Once again, it's not so much because I'm selfish than because I regularly forget that data can be shared, and that modifying one array can have repercussions on another one the other side of the code. But there's a quick fix: in the definition of MaskedArray.__new__, just change the default copy flag from True to False, that'll work. Now, Michael, you're right, and it should be the default. I'll fix that. [Thinking about it, we could store the copy flag in the array, and use that value in __getitem__ and __setitem__. That might be overkill, though]. > Unfortunately if the value is changed to masked, this is not updated > in the parent array. This seems very inconsistent. I don't view masked > values any different than any other value. Inconsistent, maybe, useful definitely: Masking a view and getting the original masked accordingly could be useful, but I strongly feel that unmasking a view and getting an unmasked orginal is dangerous. Besides, in order to make the mask updatable, you need to get it in array form, as you suggested in your version of __getitem__. But then, you drag this array all along, and I'm not sure it's worthwhile. All in all, I'd far prefer a status-quo, with unsharable masks. What does the rest of the list think (er, the MA users) ? _______________________________________________ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion