[Numpy-discussion] deprecate numpy.matrix

Charles R Harris charlesr.harris at gmail.com
Mon Feb 10 15:44:59 EST 2014


On Mon, Feb 10, 2014 at 1:23 PM, Alan G Isaac <alan.isaac at gmail.com> wrote:

> On 2/10/2014 3:04 PM, Matthew Brett wrote:
> > I teach psychologists and neuroscientists mainly
>
>
> I must suspect that notebook was not for
> **undergraduate** psychology students.
> At least, not the ones I usually meet.
>
> SymPy is great but for those without background
> it is at best awkward.  It certainly does not
> offer an equivalent to the notational convenience
> of numpy's matrix object.
>
>
> As far as I have been able to discern, the underlying
> motivation for eliminating the matrix class is that
> some developers want to stop supporting in any form
> the subclassing of numpy arrays.  Do I have that right?
>
> So the real question is not about numpy's matrix class,
> but about whether subclassing will be supported.
> (If I'm correctly reading the tea leaves.)
>
>
I don't see any reason to remove the Matrix object. It has its limitations,
I don't use it myself, but it costs little and I don't see the value of
forcing users to change.

As to subclassing ndarray, it is not recommended because it seldom saves
much work (see masked arrays), and can have side effects that are difficult
to deal with. The result of the latter is that numpy itself is called upon
to support array method overrides, of sum and mean for example. That makes
for a mess. That said, there is no movement to forbid subclassing ndarray,
but there will probably be more resistance to accommodating and fixing
problems arising from that design choice. At least that is my own feeling.

Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20140210/60696342/attachment.html>


More information about the NumPy-Discussion mailing list