[Numpy-discussion] Behavior of array scalars
Travis Oliphant
oliphant at ee.byu.edu
Fri Feb 17 15:51:01 CST 2006
Sasha wrote:
>Maybe we can change ufunc logic so that when the output argument is
>supplied it is returned without scalar conversion.
>
>
That seems sensible. Any objections? It is PyArray_Return that
changes things from 0-d array's to scalars. It's all that function has
every really done....
Notice that this behavior was always in Numeric...
a = Numeric.array(5)
a += 10
type(a)
<type 'int'>
>>> a = Numeric.array(5)
>>> type(a) == type(a+a)
False
But...
>>> a = Numeric.array(5,'f')
>>> type(a) == type(a+a)
True
So, we've been dealing with these issues (poorly) for a long time....
-Travis
More information about the Numpy-discussion
mailing list