Nick Coghlan added the comment:

If you have:

  <curdir>
    /subdir
        __main__.py

Then in 3.3+, both of the following will work:

    python3 subdir
    python3 -m subdir

They do slightly different things, though.

In the first case, "subdir" will be added to sys.path, and then python will 
execute the equivalent of "python3 -m __main__"

In the second case, the current directory will be added to sys.path, and python 
will execute the equivalent of "python3 -m subdir.__main__"

The first case is the directory execution support that was added way back in 
Python 2.6.

The second case is a combination of the package execution support added in 
Python 2.7/3.1 and the implicit namespace packages support that was added in 
Python 3.3.

Interesting find - the possibility of the latter situation hadn't occurred to 
me before :)

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue22240>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to