[Numpy-discussion] Revised NEP-18, __array_function__ protocol

Matti Picus matti.picus at gmail.com
Thu Jun 28 20:34:32 EDT 2018



On 28/06/18 17:18, Stephan Hoyer wrote:
> On Thu, Jun 28, 2018 at 1:12 PM Marten van Kerkwijk 
> <m.h.vankerkwijk at gmail.com <mailto:m.h.vankerkwijk at gmail.com>> wrote:
>
>     For C classes like the ufuncs, it seems `__self__` is defined for
>     methods as well (at least, `np.add.reduce.__self__` gives
>     `np.add`), but not a `__func__`. There is a `__name__`
>     (="reduce"), though, which means that I think one can still
>     retrieve what is needed (obviously, this also means
>     `__array_ufunc__` could have been simpler...)
>
>
> Good point!
>
> I guess this means we should encourage using __name__ rather than 
> __func__. I would not want to preclude refactoring classes from Python 
> to C/Cython.
>
>
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at python.org
> https://mail.python.org/mailman/listinfo/numpy-discussion
There was opposition to that in a PR I made to provide a wrapper around 
matmul to turn it into a ufunc. It would have left the __name__ but 
changed the __func__.
https://github.com/numpy/numpy/pull/11061#issuecomment-387468084


More information about the NumPy-Discussion mailing list