[Numpy-discussion] new NEP: np.AbstractArray and np.asabstractarray

Ryan May rmay31 at gmail.com
Fri Mar 9 14:36:47 EST 2018


On Fri, Mar 9, 2018 at 2:29 AM, Nathaniel Smith <njs at pobox.com> wrote:

> On Thu, Mar 8, 2018 at 7:06 AM, Marten van Kerkwijk
> <m.h.vankerkwijk at gmail.com> wrote:
> > A larger comment: you state that you think `np.asanyarray` is a
> > mistake since `np.matrix` and `np.ma.MaskedArray` would pass through
> > and that those do not strictly mimic `NDArray`. Here, I agree with
> > `matrix` (but since we're deprecating it, let's remove that from the
> > discussion), but I do not see how your proposed interface would not
> > let `MaskedArray` pass through, nor really that one would necessarily
> > want that.
>
> We can discuss whether MaskedArray should be an AbstractArray.
> Conceptually it probably should be; I think that was a goal of the
> MaskedArray authors (even if they wouldn't have put it that way). In
> practice there are a lot of funny quirks in MaskedArray, so I'd want
> to look more carefully in case there are weird incompatibilities that
> would cause problems. Note that we can figure this out after the NEP
> is finished, too.
>
> I wonder if the matplotlib folks have any thoughts on this? I know
> they're one of the more prominent libraries that tries to handle both
> regular and masked arrays, so maybe they could comment on how often
> they run


There's a lot of places in matplotlib where this could simplify our checks,
though probably more from a standpoint of "does this thing we've been given
need converting?"

There are also a lot of places where matplotlib needs to know if we have
actually been given a MaskedArray so that we can handle it specially.

Ryan

-- 
Ryan May
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20180309/84c69d6e/attachment-0001.html>


More information about the NumPy-Discussion mailing list