[Numpy-discussion] NEP: Dispatch Mechanism for NumPy’s high level API

Stephan Hoyer shoyer at gmail.com
Sun Jun 3 22:31:13 EDT 2018


On Sun, Jun 3, 2018 at 5:44 PM Marten van Kerkwijk <
m.h.vankerkwijk at gmail.com> wrote:

> Although I'm still not 100% convinced by NotImplementedButCoercible, I do
> like the idea that this is the default for items that do not implement
> `__array_function__`. And it might help avoid trying to find oneself in a
> possibly long list.
>

Another potential consideration in favor of NotImplementedButCoercible is
for subclassing: we could use it to write the default implementations of
ndarray.__array_ufunc__ and ndarray.__array_function__, e.g.,

class ndarray:
    def __array_ufunc__(self, *args, **kwargs):
        return NotIImplementedButCoercible
    def __array_function__(self, *args, **kwargs):
        return NotIImplementedButCoercible

I think (not 100% sure yet) this would result in exactly equivalent
behavior to what ndarray.__array_ufunc__ currently does:
http://www.numpy.org/neps/nep-0013-ufunc-overrides.html#subclass-hierarchies
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20180603/d2fe23d0/attachment.html>


More information about the NumPy-Discussion mailing list