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

Serhiy Storchaka storchaka at gmail.com
Fri Oct 30 03:21:26 EDT 2015


On 30.10.15 03:22, Terry Reedy wrote:
> Leaving IDLE aside, the reason '' is added to sys.path is so that people
> can import their own modules.  This is very useful.  Shadowing is the
> result of putting it at the front.  I have long thought this a dubious
> choice.  If '' were instead appended, people could still import modules
> that did not duplicate stdlib names.  Anyone who wanted shadowing could
> move '' to the front.  But then shadowing would be intentional, not an
> accident.

LGTM.

AFAIK the sys module can't be shadowed.



More information about the Python-Dev mailing list