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

Hameer Abbasi einstein.edison at gmail.com
Sat Nov 10 17:07:10 EST 2018

> On Saturday, Nov 10, 2018 at 6:59 PM, Marten van Kerkwijk <m.h.vankerkwijk at gmail.com (mailto:m.h.vankerkwijk at gmail.com)> wrote:
> > 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.
I agree with Stephan here, other than the fact that ndarray should be in the list of types. I can think of many cases in PyData/Sparse where I dont want to allow mixed inputs, but maybe that’s a tangential discussion.

Best Regards,
Hameer Abbasi

> -- Marten _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at python.org
> https://mail.python.org/mailman/listinfo/numpy-discussion
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20181110/a193a61d/attachment.html>

More information about the NumPy-Discussion mailing list