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

Marten van Kerkwijk m.h.vankerkwijk at gmail.com
Tue Jun 5 17:31:38 EDT 2018


Hi Stephan,

On NotImplementedButCoercible: don't forget that even a preliminary implementation of __array_function__ has always the choice of coercing its own instances to ndarray and re-calling the function; that is really no different from (though probably a bit slower than) what would happen if one returned NIBC. It does require, however, a fairly efficient way of finding arguments of one's own class, which is partially why I think it is important for there to be a quick way to find instances of one's own type; we should try to avoid having people to reimplement the dance. It may still be that types is the right vehicle for this - it just depends on how much of the state of the dance it carries. ​ On the "separate" name-space question: one thing it is not is particularly difficult, especially if one works with a decorator: effectively one already has the original function and the wrapped one; the only question is whether it would pay to keep the original one around somewhere.

I do continue to think that we will get grumbling about regressions in speed and that it would help to have the undecorated versions available. Though in my ideal world those would do no coercing whatsoever, but just take arrays, i.e., they are actually faster than the current ones.

All the best,

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



More information about the NumPy-Discussion mailing list