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

Terry Reedy tjreedy at udel.edu
Thu Feb 26 04:21:40 CET 2015


On 2/25/2015 9:38 PM, Terry Reedy wrote:
> On 2/25/2015 7:45 PM, Guido van Rossum wrote:
>> Well, you can turn warnings or off using a command line flag or by
>> making calls into the warnings module, so everyone who emulates a REPL
>> can copy this behavior. I'm not worried about that.

I just discovered that Idle uses sys.warnoptions when starting a 
subprocess, so users can get all warnings now if they want, or pass 
Nick's suggested '-Wdefault:::__main__' for main code only.

> See my later response to Nick.  After adding the one line to my
> installed 3.4.3 idlelib/run.py, the runtime DeprecationWarning raised by
>    from ftplib import Netrc; Netrc()
> is displayed, whether the above is entered in the Shell or run from the
> editor. I would not mind adding the one line to run.py (for all current
> versions) and being done with it.  Idle is mostly intended for development.
>
> Making the warning display optional would be far, far harder.

Make that just 'somewhat harder'.  Manipulating sys.warnoptions would 
affect the next restart.  It would still be perhaps 30 new lines of 
code, and some decisions on details.

-- 
Terry Jan Reedy



More information about the Python-ideas mailing list