[Numpy-discussion] strange multiplication behavior with numpy.float64 and ndarray subclass

Pierre GM pgmdevlist@gmail....
Wed Jan 21 10:43:53 CST 2009


On Jan 21, 2009, at 11:34 AM, Darren Dale wrote:

> I have a simple test script here that multiplies an ndarray subclass  
> with another number. Can anyone help me understand why each of these  
> combinations returns a new instance of MyArray:
>
> mine = MyArray()
> print type(np.float32(1)*mine)
> print type(mine*np.float32(1))
> print type(mine*np.float64(1))
> print type(1*mine)
> print type(mine*1)
>
> but this one returns a np.float64 instance?

FYI, that's the same behavior as observed in ticket #826. A first  
thread addressed that issue
http://www.mail-archive.com/numpy-discussion@scipy.org/msg13235.html
But so far, no answer has been suggested.
Any help welcome.


More information about the Numpy-discussion mailing list