[Python-ideas] Show deprecation warnings in the interactive interpreter

Serhiy Storchaka storchaka at gmail.com
Wed Feb 25 12:17:04 CET 2015


On 25.02.15 11:55, Steven D'Aprano wrote:
> I think there are three questions that should be asked:
>
> (1) How does one easy and simply enable warnings in the interactive
> interpeter?

Same as for other warnings.

     import warnings; warnings.simplefilter('once', DeprecationWarning)

Or 'module', 'always', 'error'.

> (2) If they are enabled by default, how does one easily and simply
> disable the again? E.g. from the command line itself, or from your
> PYTHONSTARTUP file.

Same as for other warnings.

     import warnings; warnings.simplefilter('ignore', DeprecationWarning)




More information about the Python-ideas mailing list