[Numpy-discussion] deprecate numpy.matrix
Chris Barker
chris.barker at noaa.gov
Mon Feb 10 17:16:28 EST 2014
On Mon, Feb 10, 2014 at 1:13 PM, Alan G Isaac <alan.isaac at gmail.com> wrote:
> Do you mean one must start out with an 'asarray'?
> Or more than that?
>
maybe np.asanyarray()
It's nice, at least in principle for duck-typed functions to return the
type they were handed. And this really is the primary issu ewith np.matrix
-- it takes some real effort to write code that preserves your objects as
the matrix type.
As I detailed in past discussion, the one thing
> I really do not like about the `matrix` design
> is that indexing always returns a matrix.
>
And that's the other one -- to be really nice and useful, I think we'd need
a row_vector and column_vector type. i.e if you iterate through a matrix,
you get a bunch of row_vector instances -- not a bunch of Nx1 matrixes.
But anyway -- there was a big ol' discussion about this a few years back --
my summary of that is:
1) not very many people use matrix
1a) Those that do, often end up dropping it as their experience develops
1b) It is a source of sonfusion -- some argue more confusion than it's
worth.
2) It might be more useful if it were substantially improved
- some of the subclassing issues
- vector types
- ???
3) A number of people had some great ideas how to improve it.
4) Not a single person with both the skill set and the bandwidth to
actually do it has shown any interest for a long time.
Given (1) and (4) -- I can see that deprecation might seem to make sense.
However, I am perfectly willing to Accept Alan's assurance that it's a
useful teaching tool in some cases as is is. Note that I would argue that
it's NOT for "newbies", but rather, useful if you want to provide
a computational environment where matrixes make sense, and the point is to
teach and work with those concepts, rather than to learn numpy in the
broader sense.
If the goal is to teach numpy for general use, I don't think you should
introduce the matrix object.
-Chris
--
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chris.Barker at noaa.gov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20140210/2245157c/attachment.html>
More information about the NumPy-Discussion
mailing list