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

Ralf Gommers ralf.gommers at gmail.com
Sun Apr 28 05:22:12 EDT 2019

On Sun, Apr 28, 2019 at 5:02 AM Nathaniel Smith <njs at pobox.com> wrote:

> On Sat, Apr 27, 2019 at 7:46 PM Stephan Hoyer <shoyer at gmail.com> wrote:
> > Worst, "__wrapped__" would be difficult to search for, because it
> already means something in Python (referring to functools.wrapped). At
> least "__numpy_implementation__" and "__skipping_array_function__" are both
> unique tokens without any existing meaning.
> It's not just functools.wrapped – there's definitely other code out
> there that reads/writes __wrapped__ attributes on arbitrary callables
> and tries to do something clever with it. Debian apparently has 182
> packages that contain the token __wrapped__ in their source code [1].
> There's a real risk that some of this code will think it knows what to
> do with numpy's __wrapped__ and be wrong, or that new code that's
> trying to skip __array_function__ dispatch will accidentally call
> someone else's __wrapped__ without realizing.

Good point, I didn't think about that.

One other thought: the proposal in this thread is about skipping the
override mechanism for numpy functions. NEP 18 reserves the freedom to swap
out __array_function__ with __array_ufunc__ if we make something a ufunc.
So __skipping_array_function__ is too limited a name, __skipping_override__
or similar would be better. And then make __array_ufunc__ respect it as

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20190428/8bc0915f/attachment.html>

More information about the NumPy-Discussion mailing list