[Python-Dev] [python-committers] Enabling depreciation warnings feature code cutoff

Simon Cross hodgestar+pythondev at gmail.com
Wed Nov 8 16:09:45 EST 2017


On Wed, Nov 8, 2017 at 10:33 PM, Nick Coghlan <ncoghlan at gmail.com> wrote:
> For interactive use, the principle ends up being "Code you write gives
> deprecation warnings, code you import doesn't" (which is the main
> aspect I care about, since it's the one that semi-regularly trips me
> up when I forget that DeprecationWarning is off by default).

I with Antoine here. The idea that "code in __main__" is the set of code someone
wrote really seems a lot like guessing (and not even very good guessing).

If everyone follows the "keep __main__ small" then scripts won't automatically
display deprecation warnings by default and so the original problem of "warnings
are easy to miss" remains.

Counter proposal -- why don't testing frameworks turn on warnings by default?
E.g. like pytest-warnings? That way people running tests will see warnings and
others won't unless they ask to see them.


More information about the Python-Dev mailing list