[Numpy-discussion] Proposal to accept NEP-18, __array_function__ protocol
Stephan Hoyer
shoyer at gmail.com
Wed Sep 26 15:59:35 EDT 2018
On Wed, Sep 26, 2018 at 9:19 AM Joris Van den Bossche <
jorisvandenbossche at gmail.com> wrote:
> Hi all,
>
> I have small question for clarification regarding some reducing numpy
> functions like np.sum, np.mean, etc, i.e. functions that now work on
> other array-like objects by checking if they have 'sum', 'mean', etc method
> and if so, "dispatch" to the method.
> Those functions are several times mentioned as examples in the text of the
> NEP, so although the NEP does not list the functions that will use the
> __array_function__ protocol explicitly, I assume that those functions
> will probably be in that list. But I wanted to check if that assumption is
> correct.
>
> Is it the intent that the functions that now dispatch to object methods
> will be updated to use the protocol instead? (probably keeping to
> method-dispatch as second try for backwards compatibility)
>
Hi Joris,
Yes, this is my exact intent. Eventually, we might remove/deprecate
automatically calling methods with the same name (due to how error prone
this is), but that is a long way in the future if ever.
Keep in mind that the current version of the NEP may not be a good fit for
pandas, because it requires overriding *all* NumPy functions. See this
section of the NEP for details:
http://www.numpy.org/neps/nep-0018-array-function-protocol.html#coercion-to-a-numpy-array-as-a-catch-all-fallback
Cheers,
Stephan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20180926/dc827137/attachment.html>
More information about the NumPy-Discussion
mailing list