[Python-Dev] Proposal: go back to enabling DeprecationWarning by default

Tim Delaney timothy.c.delaney at gmail.com
Sun Nov 5 22:51:33 EST 2017


On 6 November 2017 at 13:05, Nick Coghlan <ncoghlan at gmail.com> wrote:

> As part of this though, I'd suggest amending the documentation for
> DeprecationWarning [1] to specifically cover how to turn it off
> programmatically (`warnings.simplefilter("ignore",
> DeprecationWarning)`), at the command line (`python -W
> ignore::DeprecationWarning ...`), and via the environment
> (`PYTHONWARNINGS=ignore::DeprecationWarning`).
>

I'm wondering if it would be sensible to recommend only disabling the
warnings if running with a known version of Python e.g.

if sys.version_info < (3, 8):
    with warnings.simplefilter('ignore', DeprecationWarning):
        import module

The idea here is to prompt the developer to refactor to not use the
deprecated functionality early enough that users aren't impacted.

Tim Delaney
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20171106/359f5543/attachment.html>


More information about the Python-Dev mailing list