[Numpy-discussion] Rationale for returning type-wrapped min() / max() scalars? (was: Problem with ufunc of a numpy.ndarray derived class)

Hans Meine meine at informatik.uni-hamburg.de
Sun Jul 31 02:50:40 EDT 2011


Am 29.07.2011 um 20:23 schrieb Nathaniel Smith:
> Even so, surely this behavior should be consistent between base class
> ndarrays and subclasses? If returning 0d arrays is a good idea, then
> we should do it everywhere. If it's a bad idea, then we shouldn't do
> it at all...?

Very well put.  That's exactly the reason why I am insisting on this discussion, and why I believe that the behavior change is not intentional.  Otherwise, ndarray and matrix should behave like my subclass.  (BTW: I did not check masked_array yet.)

> (In reality, it sounds like this might be some mishap in the
> __array_wrap__ mechanism?)

That's exactly my guess.  (That could also explain why Mark did not see anything obvious in the code.)

In fact, my first thought was "maybe there was a documented change in the __array_wrap__ protocol, which we have to implement now", but obviously that is not the case.

Have a nice day,
  Hans


More information about the NumPy-Discussion mailing list