[Python-Dev] PEP 565: Show DeprecationWarning in __main__

Victor Stinner victor.stinner at gmail.com
Tue Dec 5 12:59:49 EST 2017


2017-12-05 16:50 GMT+01:00 Guido van Rossum <guido at python.org>:
> Honestly, I didn't completely follow what Victor thinks of the PEP -- his
> post seemed mostly about promoting his own -X dev flag.

-X dev is similar (but different) than -W default: show warnings which
are hidden by default otherwise. -W default works on Python 2.7 and
3.6.

> I have nothing
> against that flag but I don't see how its existence is relevant to the PEP,
> which is about giving users who don't even know they are Python developers a
> hint when they are using deprecated features (for which there always must be
> a shiny new replacement!).

I disagree that *users* of an application is supposed to "handle"
deprecation warnings: report them to the developer, or even try to fix
them. IHMO these warnings (hidden by default) were introduced for
developers of the application.

My point is that I prefer to keep the status quo: continue to hide
deprecation warnings, but promote existing solutions like -W default
to display these warnings, teach to developers how to see and fix
these warnings.

Even for developers, I'm not sure that only showing warnings in
__main__ is useful, since more and more application use a __main__
module which is a thin entry point : import + function call (ex: "from
app import main; main()").

> Therefore I am planning to accept it by the end of this week unless more objections are voiced.

It's ok if we disagree. I just wanted to share my opinion on this issue ;-)

Victor


More information about the Python-Dev mailing list