[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 08:53:23 EST 2015


In a message of Sun, 01 Nov 2015 08:25:54 -0500, Alexander Walters writes:
>Honestly, shadowing modules is something that should be solved by 
>renaming modules.  If you are worrying about shadowing ONLY the standard 
>library - guess what?  those names don't change often, and are well 
>known.  Don't use those names.  

The problem is that the sort of people who make these errors don't
know the names.  Knowing that 'turtle.py' is a bad name for 'my
very first program that does turtle graphics' is a more advanced
skill than the turtle program writers, or even their teachers, can
be expected to have.  

I'm willing to have the kids and their teachers (and all the other
beginners) suffer if the downside is that an even only
moderately-sized set of legitimate stdlib shadowers end up with an
inability to notice warning messages, because they are now ubiquitous.
I just think that legitimate stdlib shadowers are rare.  And I 
suspect that many of them do this once, for a short period, not
every day of their lives.  Thus the 'ignore this noise' is much
less likely to develop with them.

Python warnings are rare.  Choosing to add a new one is a serious
step.  I do not want to open the floodgates and end up warning about all
possibly-silly practice -- I am one of the cognitive psychology boffins
who go around asking/nudging/reminding people to warn less often if you
want your most serious warnings to be heeded.

I just think the tradeoffs here are worth it.

Laura


More information about the Python-ideas mailing list