[Numpy-discussion] Proposal to accept NEP-18, __array_function__ protocol

Stephan Hoyer shoyer at gmail.com
Fri Aug 24 19:00:27 EDT 2018


On Fri, Aug 24, 2018 at 3:14 PM Nathaniel Smith <njs at pobox.com> wrote:

> Yeah, the reason warnings are normally recommended is because
> normally, you want to make it easy to silence. But this is the rare
> case where I didn't want to make it easy to silence, so I didn't
> suggest using a warning :-).
>
> Calling warnings.warn (or the C equivalent) is also very expensive,
> even if the warning ultimately isn't displayed. I guess we could do
> our own tracking of whether we've displayed the warning yet, and only
> even attempt to issue it once, but that partially defeats the purpose
> of using warnings in the first place.


I thought the suggestion was to issue a warning when
np.enable_experimental_array_function() is called. I agree that it's a
non-starter to issue it every time an __array_function__ method is called
-- warnings are way too slow for that.

People can redirect stderr, so we're really not stopping anyone from
silencing things by doing it in a non-standard way. We're just making it
annoying and non-standard. Developers could even run Python in a subprocess
and filter out all the warnings -- there's really nothing we can do to stop
determined abusers of this feature.

I get that you want to make this annoying and non-standard, but this is too
extreme for me. Do you seriously imagine that we'll consider ourselves
beholden in the future to users who didn't take us at our word?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20180824/7db6e1ad/attachment.html>


More information about the NumPy-Discussion mailing list