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

Darren Dale dsdale24 at gmail.com
Wed Jan 21 12:05:23 EST 2009


On Wed, Jan 21, 2009 at 11:43 AM, Pierre GM <pgmdevlist at gmail.com> wrote:

>
> 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.


I dont understand why __array_priority__ is not being respected here. Ticket
826 lists the component as numpy.ma, it seems the problem is in numpy.core.
I think the severity of the ticket should be increased. But I wasnt able to
view the ticket, I keep getting an "internal server error".
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20090121/c5c8534d/attachment.html>


More information about the NumPy-Discussion mailing list