[Python-Dev] PEP 565: Show DeprecationWarning in __main__
Guido van Rossum
guido at python.org
Tue Dec 5 13:24:43 EST 2017
On Tue, Dec 5, 2017 at 9:59 AM, Victor Stinner <victor.stinner at gmail.com>
wrote:
> 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.
>
But the whole point of the PEP is that it only warns about deprecations in
code over which the user has control -- likely __main__ is their own code,
and they *can* handle it.
> 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.
>
If they import a 3rd party module which does something deprecated, the user
won't see any deprecation 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()").
>
And that's intentional -- such developers are supposed to actively test
their code, and deprecations will be shown to them by the unittest
framework. Having a minimal __main__ implies that their users won't see any
deprecation warnings.
> > 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 ;-)
>
I just worry that your opinion might be based on a misunderstanding of the
proposal. If we agree on what the PEP actually proposed to change, and how
that will affect different categories of users and developers, I am okay
with disagreement.
--
--Guido van Rossum (python.org/~guido)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20171205/9b8e6a68/attachment.html>
More information about the Python-Dev
mailing list