On Oct 29, 2015 6:26 PM, "Terry Reedy" <tjre...@udel.edu> wrote:
>
> On 10/29/2015 11:59 AM, Laura Creighton wrote:
>>
>>
>> see the following:
>> lac@smartwheels:~/junk$ echo "print ('hello there')" >string.py
>> lac@smartwheels:~/junk$ idle-python3.5
>> hello there
>> Traceback (most recent call last):
>>    File "<string>", line 1, in <module>
>>    File "/usr/lib/python3.5/idlelib/run.py", line 10, in <module>
>>      from idlelib import CallTips
>>    File "/usr/lib/python3.5/idlelib/CallTips.py", line 16, in <module>
>>      from idlelib.HyperParser import HyperParser
>>    File "/usr/lib/python3.5/idlelib/HyperParser.py", line 14, in <module>
>>      _ASCII_ID_CHARS = frozenset(string.ascii_letters + string.digits +
"_")
>> AttributeError: module 'string' has no attribute 'ascii_letters'
>>
>> IDLE then produces a popup that says:
>>
>> IDLE's subprocess didn't make connection.  Either IDLE can't stat a
subprocess por personal firewall software is blocking the connection. <ok>
>>
>> --------
>>
>> I think that life would be a whole lot easier for people if instead we
got
>> a message:
>>
>> Warning: local file /u/lac/junk/string.py shadows module named string in
the
>> Standard Library
>>
>> I think that it is python exec that would have to do this -- though of
>> course the popup could also warn about shadowing in general, instead of
>> sending people on wild goose chases over their firewalls.
>>
>> Would this be hard to do?
>
>
> 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.

Unfortunately I think that (among other things) there are a lot of scripts
out there that blindly do sys.path.pop(0) to remove the "" entry, so the
backcompat costs of changing this would probably be catastrophic.

-n
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to