<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div><font color="#000000"><span style="caret-color: rgb(0, 0, 0);">I’m </span></font>On 25. Aug 2018, at 00:13, Nathaniel Smith <<a href="mailto:njs@pobox.com">njs@pobox.com</a>> wrote:<br><br></div><blockquote type="cite"><div><span>On Fri, Aug 24, 2018 at 1:46 PM, Stephan Hoyer <<a href="mailto:shoyer@gmail.com">shoyer@gmail.com</a>> wrote:</span><br><blockquote type="cite"><span>On Fri, Aug 24, 2018 at 1:36 AM Hameer Abbasi <<a href="mailto:einstein.edison@gmail.com">einstein.edison@gmail.com</a>></span><br></blockquote><blockquote type="cite"><span>wrote:</span><br></blockquote><blockquote type="cite"><blockquote type="cite"><span></span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span></span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span>On Fri, Aug 24, 2018 at 9:38 AM Nathaniel Smith <<a href="mailto:njs@pobox.com">njs@pobox.com</a>> wrote:</span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><span></span><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><span>On Thu, Aug 23, 2018 at 9:02 AM,  <<a href="mailto:einstein.edison@gmail.com">einstein.edison@gmail.com</a>> wrote:</span><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><span>I might add that most duck array authors are highly unlikely to be</span><br></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><span>newcomers</span><br></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><span>to the Python space. We should just put a big warning there while</span><br></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><span>enabling</span><br></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><span>and that’ll be enough to scare away most devs from doing it by default.</span><br></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><span></span><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><span>That's a reasonable idea... a Big Obnoxious Warning(tm) when it's</span><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><span>enabled, or on first use, would achieve a lot of the same purpose.</span><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><span>E.g.</span><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><span></span><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><span>if this_is_the_first_array_function_usage():</span><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><span>    sys.stderr.write(</span><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><span>        "WARNING: this program uses NumPy's experimental</span><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><span>'__array_function__' feature.\n"</span><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><span>        "It may change or be removed without warning, which might</span><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><span>break this program.\n"</span><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><span>        "For details see</span><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><span><a href="http://www.numpy.org/neps/nep-0018-array-function-protocol.html\n">http://www.numpy.org/neps/nep-0018-array-function-protocol.html\n</a>"</span><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><span>    )</span><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><span></span><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><span>-n</span><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><span></span><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span></span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span>I was thinking of a FutureWarning... That's essentially what it's for.</span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span>Writing to stderr looks un-pythonic to me.</span><br></blockquote></blockquote><blockquote type="cite"><span></span><br></blockquote><blockquote type="cite"><span></span><br></blockquote><blockquote type="cite"><span>Issuing a FutureWarning seems roughly appropriate here. The Python 3.7 docs</span><br></blockquote><blockquote type="cite"><span>write:</span><br></blockquote><blockquote type="cite"><span>"Base category for warnings about deprecated features when those warnings</span><br></blockquote><blockquote type="cite"><span>are intended for end users of applications that are written in Python."</span><br></blockquote><blockquote type="cite"><span></span><br></blockquote><blockquote type="cite"><span>Writing to sys.stderr directly is generally considered poor practice for a</span><br></blockquote><blockquote type="cite"><span>Python libraries.</span><br></blockquote><blockquote type="cite"><span></span><br></blockquote><blockquote type="cite"><span>In my experience FutureWarning does a good job of satisfying the goals of</span><br></blockquote><blockquote type="cite"><span>being a "Big Obnoxious Warning" while still being silence-able and testable</span><br></blockquote><blockquote type="cite"><span>with standard tools.</span><br></blockquote><span></span><br><span>Yeah, the reason warnings are normally recommended is because</span><br><span>normally, you want to make it easy to silence. But this is the rare</span><br><span>case where I didn't want to make it easy to silence, so I didn't</span><br><span>suggest using a warning :-).</span><br></div></blockquote><div><br></div><div>I really doubt anyone is going to silence a FutureWarning and then come complaining that a feature was removed.</div><div><br></div><blockquote type="cite"><div><span></span><br><span>Calling warnings.warn (or the C equivalent) is also very expensive,</span><br><span>even if the warning ultimately isn't displayed. I guess we could do</span><br><span>our own tracking of whether we've displayed the warning yet, and only</span><br><span>even attempt to issue it once, but that partially defeats the purpose</span><br><span>of using warnings in the first place.</span><br></div></blockquote><div><br></div><div>How about calling it at enable-time once? That’s why I suggested that in the first place.</div><br><blockquote type="cite"><div><span></span><br><span>-n</span><br><span></span><br><span>-- </span><br><span>Nathaniel J. Smith -- <a href="https://vorpus.org">https://vorpus.org</a></span><br><span>_______________________________________________</span><br><span>NumPy-Discussion mailing list</span><br><span><a href="mailto:NumPy-Discussion@python.org">NumPy-Discussion@python.org</a></span><br><span><a href="https://mail.python.org/mailman/listinfo/numpy-discussion">https://mail.python.org/mailman/listinfo/numpy-discussion</a></span><br></div></blockquote><br><div>Best regards,</div><div>Hameer Abbasi</div><div><span style="background-color: rgba(255, 255, 255, 0);">Sent from my iPhone</span></div></body></html>