[Numpy-discussion] Short-hand array creation in `numpy.mat` style

Nathaniel Smith njs at pobox.com
Fri Jul 18 14:49:04 EDT 2014


On 18 Jul 2014 18:06, "Alan G Isaac" <alan.isaac at gmail.com> wrote:
>
> On 7/18/2014 12:45 PM, Mark Miller wrote:
> > If the true goal is to just allow quick entry of a 2d array, why not
just advocate using
> > a = numpy.array(numpy.mat("1 2 3; 4 5 6; 7 8 9"))
>
>
> It's even simpler:
> a = np.mat(' 1 2 3;4 5 6;7 8 9').A
>
> I'm not putting a dog in this race.  Still I would say that
> the reason why such proposals miss the point is that
> there are introductory settings where one would like
> to explain as few complications as possible.  In
> particular, one might prefer *not* to discuss the
> existence of a matrix type.  As an additional downside,
> this is only good for 2d, and there have been proposals
> for the new array builder to handle other dimensions.

Going through np.mat also fails on the meta-goal, which is to remove
reasons for people to prefer np.matrix to np.ndarray, so that eventually we
can deprecate the former without harm.

As far as this goal goes, it's all very well for some of us to say that
users should toughen up or whatever, but it's useless: they'll just ignore
you and use np.mat because it's easier. And then we have even more of a
mess to clean up later.

-n
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20140718/f15cde11/attachment.html>


More information about the NumPy-Discussion mailing list