[Numpy-discussion] Bug in np.nonzero / Should index returning functions return ndarray subclasses?

Marten van Kerkwijk m.h.vankerkwijk at gmail.com
Tue May 12 11:49:07 EDT 2015


Agreed that indexing functions should return bare `ndarray`. Note that in
Jaime's PR one can override it anyway by defining __nonzero__.  -- Marten

On Sat, May 9, 2015 at 9:53 PM, Stephan Hoyer <shoyer at gmail.com> wrote:

>  With regards to np.where -- shouldn't where be a ufunc, so subclasses or
> other array-likes can be control its behavior with __numpy_ufunc__?
>
> As for the other indexing functions, I don't have a strong opinion about
> how they should handle subclasses. But it is certainly tricky to attempt to
> handle handle arbitrary subclasses. I would agree that the least error
> prone thing to do is usually to return base ndarrays. Better to force
> subclasses to override methods explicitly.
>
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20150512/f129a508/attachment.html>


More information about the NumPy-Discussion mailing list