[Numpy-discussion] Adding to the non-dispatched implementation of NumPy methods

Ralf Gommers ralf.gommers at gmail.com
Mon May 13 06:51:34 EDT 2019


On Sat, May 11, 2019 at 4:04 AM Stephan Hoyer <shoyer at gmail.com> wrote:

> On Sat, May 4, 2019 at 12:29 PM Ralf Gommers <ralf.gommers at gmail.com>
> wrote:
>
>> We seem to have run out of steam a bit here.
>>
>
> We discussed this today in person at the NumPy sprint.
>
> The consensus was to go for a name like __skip_array_function__. Ufuncs
> don't have very good use-cases for a function that skips dispatch:
> 1. The overhead of the ufunc dispatch machinery is much smaller,
> especially in the case where all arguments are NumPy arrays, because there
> is no need for a wrapper function in Python.
> 2. Inside __array_ufunc__ it's possible to cast arguments into NumPy
> arrays explicitly and then call the ufunc again. There's no need to
> explicitly skip overrides.
>
> We also don't really care about supporting the use-case where a function
> gets changed into a ufunc. We already warn users not to call
> __skip_array_function__ directly (without using getattr) outside
> __array_function__.
>
> Given all this, it seems best to stick with a name that mirrors
> __array_function__ as closely as possible. I picked "skip" instead of
> "skpping" just because it's slightly shorter, but otherwise don't have a
> strong preference.
>
> I've edited the NEP [1] and implementation [2] pull requests to use this
> new name, and clarify the use-cases. If there no serious objections, I'd
> love to merge these soon, in time for the NumPy 1.17 release candidate.
>
> [1] https://github.com/numpy/numpy/pull/13305
> [2] https://github.com/numpy/numpy/pull/13389
>

Thanks for the update Stephan, that all sounds good to me. Looks like it
was a productive sprint!

Cheers,
Ralf
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20190513/3ce4917e/attachment-0001.html>


More information about the NumPy-Discussion mailing list