[Numpy-discussion] return type of ndarray + ma.array
Alexander Belopolsky
alexander.belopolsky at gmail.com
Thu Jan 5 20:51:09 EST 2006
the following session demonstrates the difference between numpy.ma
and old MA behavior.
Sum ndarray and ma.array is ndarray
>>> type(numeric.array([1])+ma.array([1]))
<type 'numpy.ndarray'>
However, taken in the different order,
>>> type(ma.array([1])+numeric.array([1]))
<class 'numpy.core.ma.MaskedArray'>
In the old MA module the sum is MaskedArray in any order:
>>> type(MA.array([1])+Numeric.array([1]))
<class 'MA.MaskedArray'>
>>> type(Numeric.array([1])+MA.array([1]))
<class 'MA.MaskedArray'>
I suspected that new ma module may not have __radd__ defined, but it
does.
Can anyone explain this?
Thanks.
-- sasha
PS:
>>> import numpy
>>> numpy.__version__
'0.9.3.1831'
More information about the NumPy-Discussion
mailing list