[Numpy-discussion] About asarray (list)

Claude Gouedard cgoued at gmail.com
Wed Aug 27 10:48:48 EDT 2008


Hi ,

I'm just surprised by the behaviour of numpy.asarray on  lists.

Can someone comment this :
=====================
a=(1)
aa=asarray(a)
print  aa.size , aa.shape
>> 1   ( )
=====================

The shape  doesnot reflect the actual size.

If a=(1,2)  there is no problem .
=====================
aa=asarray((1,2))
print  aa.size , aa.shape
>> 2   (2, )
=====================
... same  for sequences:
=====================
aa=asarray( [1] )
 print  aa.size , aa.shape
>> 1  (1, )
=====================

Thanks
Claude Gouedard
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20080827/a9e3fafc/attachment.html>


More information about the NumPy-Discussion mailing list