[Python-ideas] [Python-Dev] If you shadow a module in the standard library that IDLE depends on, bad things happen

Laura Creighton lac at openend.se
Sun Nov 1 04:49:49 EST 2015


In a message of Sun, 01 Nov 2015 20:02:23 +1100, Chris Angelico writes:
>> But the kid who just wrote string.py or turtle.py will still have
>> the 'why isn't this working at all?' experience instead of something
>> that warns her what her problem is.
>
>Right. The warning when you save a file of that name is still a useful
>thing; it's orthogonal to this, though. (FWIW I think the warning's a
>good idea, but it's no panacea.)
>
>ChrisA

Adding warnings to IDLE when you save a file is a fine idea, and will
help IDLE users avoid pain.  I want to help _everybody_ with a change
to Python, so that it issues a warning when you shadow something in
the standard library.

Something like:
Warning: local file /u/lac/junk/string.py shadows module named string in the 
Standard Library

Note, for somebody implementing this.  Teachers will find the message slightly
more useful if it prints the full path name.

Laura


More information about the Python-ideas mailing list