diff options
author | Eric Wieser <wieser.eric@gmail.com> | 2017-04-19 21:49:10 +0100 |
---|---|---|
committer | Eric Wieser <wieser.eric@gmail.com> | 2017-04-19 23:06:51 +0100 |
commit | 73c15f7b30658cbedc9c42e59b818b3d77dbc2c3 (patch) | |
tree | 1bc89d6a0eeb1b770f9269d22c1843c7d6cfc01b /numpy/ma | |
parent | 2597a167e181583b6c0e8ec506ff0ef9986a105f (diff) | |
download | numpy-73c15f7b30658cbedc9c42e59b818b3d77dbc2c3.tar.gz |
DOC: Improve comments in ma.array.__new__
Diffstat (limited to 'numpy/ma')
-rw-r--r-- | numpy/ma/core.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/numpy/ma/core.py b/numpy/ma/core.py index 8179dc930..554fd6dc5 100644 --- a/numpy/ma/core.py +++ b/numpy/ma/core.py @@ -2784,9 +2784,10 @@ class MaskedArray(ndarray): # Check that we're not erasing the mask. if isinstance(data, MaskedArray) and (data.shape != _data.shape): copy = True - # Careful, cls might not always be MaskedArray. + + # Here, we copy the _view_, so that we can attach new properties to it # we must never do .view(MaskedConstant), as that would create a new - # instance of np.ma.masked, which would be confusing + # instance of np.ma.masked, which make identity comparison fail if isinstance(data, cls) and subok and not isinstance(data, MaskedConstant): _data = ndarray.view(_data, type(data)) else: |