[Numpy-discussion] Revised NEP-18, array_function protocol (original) (raw)

Marten van Kerkwijk m.h.vankerkwijk at gmail.com
Sat Jun 30 09:55:29 EDT 2018


On Fri, Jun 29, 2018 at 9:54 PM, Eric Wieser <wieser.eric+numpy at gmail.com> wrote:

Good catch,

I think the latter failing is because np.add.reduce ends up calling np.ufunc.reduce.get(np.add), and builtinfunction.get doesn’t appear to do any caching. I suppose caching bound methods would just be a waste of time. == would work just fine in my suggestion above, it seems - irrespective of the resolution of the discussion on python-dev. Eric I think for implementers it might work easiest anyway to look up the ufunc itself in a dict or so and then check the name of the method. (At least, for my impementations of __array_ufunc__, it made a lot of sense to use the method in that way; possibly less so for the larger variety with other numpy functions).

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



More information about the NumPy-Discussion mailing list