[Numpy-discussion] Why is the shape of a singleton array the empty tuple?

David Goldsmith d.l.goldsmith@gmail....
Sat Mar 6 23:46:21 CST 2010


On Sat, Mar 6, 2010 at 9:37 PM, Ian Mallett <geometrian@gmail.com> wrote:

> >>> x = numpy.array(3)
> >>> x
> array(3)
> >>> x.shape
> ()
> >>> y = numpy.array([3])
> >>> y
> array([3])
> >>> y.shape
> (1,)
>
> Ian
>

Thanks, Ian.  I already figured out how to make it not so, but I still want
to understand the design reasoning behind it being so in the first place
(thus the use of the question "why (is it so)," not "how (to make it
different)").

DG
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20100306/c4c90120/attachment.html 


More information about the NumPy-Discussion mailing list