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

Nathaniel Smith njs at pobox.com
Fri Jul 29 14:23:38 EDT 2011


On Jul 28, 2011 8:43 AM, "Matthew Brett" <matthew.brett at gmail.com> wrote:
> So, 1.6.0 is returning a zero-dimensional scalar of the given type,
> and 1.5.1 returns a python scalar.
>
> Zero dimensional scalars are designed to behave in a similar way to
> python scalars, so the change should be all but invisible in practice.
>  Was there a particular case you ran into where this was a problem?

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

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

- Nathaniel



More information about the NumPy-Discussion mailing list