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

Steven D'Aprano steve at pearwood.info
Sun Nov 1 06:26:30 EST 2015


On Sun, Nov 01, 2015 at 08:02:23PM +1100, Chris Angelico wrote:
> On Sun, Nov 1, 2015 at 7:08 PM, Laura Creighton <lac at openend.se> wrote:
[...]
> > 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.)

I disagree.

As shown by the tutor and python-list mailing lists, beginners don't 
read error messages. Warning them that they're about to save a file 
using the name of a stdlib module will be no different. They'll either 
ignore the warning, and still be in the dark as to why their code is 
broken, or they'll panic that they did something wrong, and possibly 
lose their as yet unsaved work.

What produces the warning? Python, or the editor? If Python, you're 
annoying experienced programmers who intend to do what they do. If the 
editor, you do nothing about people using a different editor, or people 
who move and rename files in the shell.


-- 
Steve


More information about the Python-ideas mailing list