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

Nathaniel Smith njs at pobox.com
Sat Apr 27 23:01:32 EDT 2019

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.


[1] https://codesearch.debian.net/search?q=__wrapped__&perpkg=1

Nathaniel J. Smith -- https://vorpus.org

More information about the NumPy-Discussion mailing list