[Python-ideas] Disallow importing the same module under multiple names

Chris Billington chrisjbillington at gmail.com
Tue Mar 20 19:58:16 EDT 2018


I don't think that's true:



On Wed, Mar 21, 2018 at 10:51 AM, Greg Ewing <greg.ewing at canterbury.ac.nz>
wrote:

> Chris Billington wrote:
>
>> I wonder how mercurial gets around the fact that its own imports might be
>> shadowed by whatever's in the current working directory.
>>
>
> The cwd is only added to sys.path in the interactive interpreter,
> not when you run "python something.py". So it's not usually a
> problem for applications implemented in Python.
>
>
I don't think that's true:

$ cd /tmp
$ echo 'import bar' > foo.py
$ echo 'print("this is bar")' > bar.py
$ python foo.py
this is bar

(/tmp is not in the python path)

-Chris

> --
> Greg
>
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20180321/cc1d5b6d/attachment-0001.html>


More information about the Python-ideas mailing list