Why does numpy.array(a[0],b[0]) have this meaning?

alex goretoy aleksandr.goretoy at gmail.com
Mon Nov 3 02:40:49 EST 2008


just a shot in the dark.

second arg to numpy.array is of type

see numpy.array.__doc__

-nop


On Mon, Nov 3, 2008 at 1:26 AM, Rick Giuly <rgiuly.group at yahoo.com> wrote:

> Hello All,
>
> Case 1
> This generates an error, which makes sense because the argument should
> be a list of numbers:
> numpy.array(10,10)
>
> Case 2
> This does not generate an error and the result is an array with a
> single element:
> a = numpy.array([10])
> b = numpy.array([10])
> numpy.array(a[0],b[0])
>
> The only different I see here between the numpy.array call in the
> cases is that
> a[0] is a numpy int32
> 10 is an int
>
> Why would this minor difference in integer types cause a totally
> different result for the two cases - or is something else causing the
> difference in results?
>
>
> -rick
>
> P.S.
> I am aware that numpy.array([10,10]) will work, but I'm trying to
> understand what is going on syntactically/semantically in the two
> cases above.
>
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20081103/4cc0e71b/attachment-0001.html>


More information about the Python-list mailing list