(original) (raw)



On Fri, Jun 29, 2018 at 9:54 PM, Eric Wieser <wieser.eric+numpy@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 builtin\_function.\_\_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