[Numpy-discussion] numpy.ma bug

Travis Oliphant oliphant.travis at ieee.org
Fri Mar 10 02:32:04 EST 2006


Sasha wrote:
> I would say it is an ma bug, but don't know how to fix it properly
> without changing numpy scalar arithmetic to call an enhanced version
> of __array__ and pass context in.
>   
I think it was an array scalar bug.  I've fixed it by always calling the 
ufunc (which handles conversions to and from other objects better than 
the array scalars were doing in the generic arithmetic code). 

The result is shorter code and symmetric handling of the 
<array_scalar>*<masked array>  vs. <masked array> * <array_scalar> case.

I also changed the error to a warning for backward compatibility.  
Calling __array__() on a masked array should succeed and we will assume 
the user knows what they are doing.

-Travis





More information about the NumPy-Discussion mailing list