[Numpy-discussion] Interesting bug with numpy.ma
Pierre GM
pgmdevlist at gmail.com
Sat Sep 27 14:49:22 EDT 2008
All,
I've just been pointed to a strange bug in numpy.ma
import numpy as np
import numpy.ma as ma
assert(ma.masked*float(1) is ma.masked)
assert(float(1)*ma.masked is ma.masked)
assert(ma.masked*np.float(1) is ma.masked)
assert(np.float(1)*ma.masked is ma.masked)
assert(ma.masked*np.float_(1) is ma.masked)
assert(np.float_(1)*ma.masked is ma.masked)
The last assertion fails, and I have no idea why. What's the difference
between assertions 3 and 5 ? FYI,
ma.masked=ma.MaskedArray(0.,dtype=np.float_,mask=True), and MaskedArray has a
__array_priority__ of 15.
Implementing a __rmul__ doesn't work either.
Any idea welcome.
More information about the NumPy-Discussion
mailing list