[Numpy-discussion] Should unique types of all arguments be passed on in __array_function__?

Marten van Kerkwijk m.h.vankerkwijk at gmail.com
Sat Nov 10 12:59:01 EST 2018


> More broadly, it is only necessary to reject an argument type at the
> __array_function__ level if it defines __array_function__ itself, because
> that’s the only case where it would make a difference to return
> NotImplemented rather than trying (and failing) to call the overriden
> function implementation.
>

Yes, this makes sense -- these are the only types that could possibly
change the outcome if the class now called fails to produce a result.
Indeed, that reasoning makes it logical that `ndarray` itself is not
present even though it defines `__array_ufunc__` - we know it cannot handle
anything with a `__array_ufunc__` implementation.

Hameer, is Stephan's argument convincing to you too? If so, I'll close the
PR.

-- Marten
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20181110/b890e36d/attachment.html>


More information about the NumPy-Discussion mailing list