[Python-Dev] PEP 395: Module Aliasing

Nick Coghlan ncoghlan at gmail.com
Sat Mar 5 02:10:15 CET 2011

On Sat, Mar 5, 2011 at 3:04 AM, Steven D'Aprano <steve at pearwood.info> wrote:
> I think you mean that sys.path[0] will be set to the directory path.

Indeed I did.

> Should the current working directory continue to be included in the path
> when running a sub-package module?

No, it would be similar to the current difference between "python
foo.py" and "python -m foo", with the former forcing path[0] to a
specific directory, while the latter follows the vagaries of the
current working directory.

~/devel$ cat > foo.py
import sys
print (repr(sys.path[0]))
~/devel$ python foo.py
~/devel$ python -m foo

I'll elaborate on that point in the next update.


Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia

More information about the Python-Dev mailing list