osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Python-Dev] Removing PendingDeprecationWarning


Le ven. 22 mars 2019 ? 13:05, Serhiy Storchaka <storchaka at gmail.com> a ?crit :
> > The main problem is complexity.  In other words, learning cost.
>
> Do you have evidences that many people have troubles with learning
> PendingDeprecationWarning?

I have no idea when I should use PendingDeprecationWarning rather than
DeprecationWarning. For example, let's say that we deprecate a feature
in Python N with an open question of remove it from Python N+1 or N+2.
Should I started with PendingDeprecationWarning?

The following discussion mentioned that many deprecated features are
not removed just because everybody forgot to remove it:
https://discuss.python.org/t/pendingdeprecationwarning-is-really-useful/1038

And I consider that it's perfectly fine to not have a strict plan to
remove a feature as part of a deprecation. The usage of a deprecated
feature can evolve. There are a few exceptions of deprecated features
which were only modified to remove the deprecation, rather than
removing the feature, because we decided that the fetaure must stay.
Python language is living, its usage is changing frequently.

About showing warnings: I never ever used a specific filter to only
hide PendingDeprecationWarning but show DeprecationWarning. When I
want to fix warnings, I want to fix all of them, pending or not. I
would like to prepare a project for all future Python versions, not
only fix DeprecationWarning.

"python3 -X dev", "python3 -Wd" and python3 compiled in debug modes
all show DeprecationWarning *and* PendingDeprecationWarning. The
granularity no longer matters.

It was useful to have PendingDeprecationWarning when it was hidden by
default, whereas DeprecationWarning warnings were displayed by
default. But now both are hidden by default.

Well, maybe read the whole previous discussion for the full rationale:
https://discuss.python.org/t/pendingdeprecationwarning-is-really-useful/1038



> Perhaps the better solution of this is to improve the documentation.
>
> PendingDeprecationWarning means that you still can use the deprecated
> feature.

Honestly, I'm not really excited by using a feature that is tagged to
be deprecated in the future... IMHO the difference between
PendingDeprecationWarning and DeprecationWarning is too subtle to be
useful in practice.


> PendingDeprecationWarning just give us time to add an alternate way if
> it is not available yet, and give Python programmers time to adapt their
> code.

Do you have some examples?

Victor
-- 
Night gathers, and now my watch begins. It shall not end until my death.