On Fri, Jun 29, 2018 at 9:54 PM, Eric Wieser <wieser.eric+nu...@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
_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@python.org
https://mail.python.org/mailman/listinfo/numpy-discussion

Reply via email to