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

Darren Dale dsdale24@gmail....
Fri Jan 23 10:53:00 CST 2009


On Wed, Jan 21, 2009 at 1:07 PM, Darren Dale <dsdale24@gmail.com> wrote:

>
>
> On Wed, Jan 21, 2009 at 12:26 PM, Pierre GM <pgmdevlist@gmail.com> wrote:
>
>> > 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".
>>
>> Ticket #826 bumped.
>>
>
> Just an additional bit of context. I'm working on a subclass that handles
> physical quantities, and issue 826 causes a quantity to be converted to a
> dimensionless magnitude.
>

I wonder if this issue is appearing in other places as well. Many of the
ndarray methods work without modification on my Quantity subclass, but the
methods that produce scalars do not. For instance, __getitem__ yields a
dimensionless number when called with an integer index, but  it yields
another Quantity if called with a range, so I have to reimplement
__getitem__ so it yields a quantity for single indices. tolist, min, max,
mean, are the same way. Is there an ndarray attribute I should be using to
tell the superclass what is the desired type (aside from
__array_priority__)?

Thanks,
Darren
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/numpy-discussion/attachments/20090123/a80daa43/attachment.html 


More information about the Numpy-discussion mailing list