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

Serhiy Storchaka storchaka at gmail.com
Sun Nov 19 05:26:40 EST 2017


13.11.17 01:34, Nick Coghlan пише:
> On 13 November 2017 at 03:10, Serhiy Storchaka <storchaka at gmail.com> wrote:
>> 12.11.17 11:24, Nick Coghlan пише:
>>>
>>> The PEP also proposes repurposing the existing FutureWarning category
>>> to explicitly mean "backwards compatibility warnings that should be
>>> shown to users of Python applications" since:
>>>
>>> - we don't tend to use FutureWarning for its original nominal purpose
>>> (changes that will continue to run but will do something different)
>>
>> FutureWarning currently is used for its original nominal purpose in the re
>> and ElementTree modules.
> 
> If the future warnings relate to regex and XML parsing, they'd still
> fall under the "for display to users" category, since those modules
> can't tell if the input data was application provided or part of an
> end user interface like a configuration file.

In the case of regular expressions or XPath the warnings could fall 
under the "for display to users" category, though in most cases they are 
emitted for hardcoded expressions. It is easy to fix these expressions, 
making them working ambiguously in past and future versions, and the 
author should do this. But FutureWarning is also raised in the __bool__ 
method which will change its meaning in future (the similar change was 
made for the midnight time object).

It seems to me that most of issues with FutureWarning on GitHub [1] are 
related to NumPy and pandas which use FutureWarning for its original 
nominal purpose, for warning about using programming interfaces that 
will change the behavior in future. This doesn't have any relation to 
end users unless the end user is an author of the written code.

[1] https://github.com/search?q=FutureWarning&type=Issues



More information about the Python-Dev mailing list