[Numpy-discussion] Inheriting from ndarray Was: deprecate numpy.matrix
Charles R Harris
charlesr.harris at gmail.com
Tue Feb 11 01:16:30 EST 2014
On Mon, Feb 10, 2014 at 9:01 PM, Alexander Belopolsky <ndarray at mac.com>wrote:
> On Mon, Feb 10, 2014 at 11:31 AM, Nathaniel Smith <njs at pobox.com> wrote:
>> And in the long run, I
>> think the goal is to move people away from inheriting from np.ndarray.
> This is music to my ears, but what is the future of numpy.ma? I
> understand that numpy.oldnumeric.ma (the older version written without
> inheritance) has been deprecated and slated to be removed in 1.9. I also
> have seen some attempts to bring ma functionality into the core ndarray
> object, but those have not been successful as far as I can tell.
numpy.ma is pretty much unmaintained at the moment, but it is pretty stable
and there are no plans to remove it. I'm kinda sad that moving the
functionality into numpy came to naught, but the time was short and the
disagreements were long. Hopefully we learned something in the attempt. I
don't know of any plans for masked arrays at the moment apart for waiting
to see what happens with dynd. I don't know what the chances of an overhaul
might be, or even if it could be made without disturbing current code. I
think we would have to offer something special to motivate folks to even
think of switching.
> In general, what is the future of inheriting from np.ndarray?
Well, we can't do much about it except discourage it. It is often a bad
design decision that people get sucked into because they want to borrow
some functionality. OTOH, there hasn't been an easy way to make use of
ndarray functionality for non-subclasses, and there is a *lot* to implement
to make an ndarray like object. Hopefully the new `__numpy_ufunc__`
attribute will make that easier.
If you have suggestions we'd like to hear them.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the NumPy-Discussion