[issue35375] name shadowing while a module tries to import another

2018-12-02 Thread Sriram Krishna
Sriram Krishna added the comment: Already covered in issue29929: https://bugs.python.org/issue29929. Thanks xtreak for the link to the message thread. PEP 432 seems to have methods to resolve this. Currently if the code doesn't access to .local, one can use the -I commandline optio

[issue35375] name shadowing while a module tries to import another

2018-12-02 Thread Sriram Krishna
Sriram Krishna added the comment: My contention is that this behaviour breaks the Principle of Least Astonishment. In the particular example I gave, the user doesn't know (and can't be expected to know) the existence of a module called profile in the standard library. Here the u

[issue35375] name shadowing while a module tries to import another

2018-12-02 Thread Sriram Krishna
New submission from Sriram Krishna : Suppose I have a file profile.py in the same directory as the file I am running (say test.py) Let the contents of the files be: profile.py: raise Exception test.py: import cProfile now if I run test.py $ python test.py Traceback (most recent call last