[Numpy-discussion] 1.2 tasks

Darren Dale dsdale24@gmail....
Mon Aug 4 17:43:46 CDT 2008


On Monday 04 August 2008 6:27:12 pm you wrote:
> On Monday 04 August 2008 17:53:54 you wrote:
>  In my example, it is not
>
> > just that concat is stripping the units, it is returning a different
> > type.
>
> By that, you mean that the result is not a NDQuantity ? Ah.
>
> As you mentioned Travis' email, you must have noticed he was talking about
> priorities: set a __array_priority__ argument as class variable of
> NDQuantity with a value higher than 1 and hop ! You have a ndquantity at
> the end. Except that in your case, you can't print it, because it doesn't
> have a ._units. Not a surprise, as your __array_finalize__ doesn't define a
> ._units unless the obj parameter is already a ndquantity: here, that's not
> the case, there's a conversion to ndarray under the hood during
> concatenate, then a call to __array_finalize__ with a ndarray as obj.
>
> So, in fact, all is well and works as it should on the numpy part.

I stand corrected. I must have misunderstood the documentation of 
__array_priority__ in the numpy manual. Thank you for helping clear this up!

Darren


More information about the Numpy-discussion mailing list