diff options
| author | John Kirkham <kirkhamj@janelia.hhmi.org> | 2016-01-15 16:11:10 -0500 |
|---|---|---|
| committer | John Kirkham <kirkhamj@janelia.hhmi.org> | 2016-01-15 16:11:10 -0500 |
| commit | 2f7e491aeeb77fb9d40c9108e57922b876077c3c (patch) | |
| tree | d692a5a868918265e46755028d51ecad83505bbd | |
| parent | aa6335c494e4807d65404d91e0e9d25a7d2fe338 (diff) | |
| download | numpy-2f7e491aeeb77fb9d40c9108e57922b876077c3c.tar.gz | |
DEP: Add warnings to `__getitem__` and `__setitem__` to point out the behavior of `MaskedArray`'s masks is changing.
| -rw-r--r-- | numpy/ma/core.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/numpy/ma/core.py b/numpy/ma/core.py index 6b1f09f19..690655b36 100644 --- a/numpy/ma/core.py +++ b/numpy/ma/core.py @@ -3105,6 +3105,14 @@ class MaskedArray(ndarray): Return the item described by i, as a masked array. """ + # 2016.01.15 -- v1.11.0 + warnings.warn( + "Currently, slicing will try to return a view of the data," + + " but will return a copy of the mask. In the future, it will try" + + " to return both as views.", + FutureWarning + ) + dout = self.data[indx] # We could directly use ndarray.__getitem__ on self. # But then we would have to modify __array_finalize__ to prevent the @@ -3175,6 +3183,15 @@ class MaskedArray(ndarray): locations. """ + # 2016.01.15 -- v1.11.0 + warnings.warn( + "Currently, slicing will try to return a view of the data," + + " but will return a copy of the mask. In the future, it will try" + + " to return both as views. This means that using `__setitem__`" + + " will propagate values back through all masks that are present.", + FutureWarning + ) + if self is masked: raise MaskError('Cannot alter the masked element.') _data = self._data |
