
July 16, 2015
3:28 a.m.
Ezio Melotti added the comment:
I think this is due to PEP 420 Namespace Packages.
It works on Python 2 too: $ ls execdir/ foo.py __main__.py $ cat execdir/foo.py print("foo imported") $ cat execdir/__main__.py import foo; print("main imported") $ python execdir/ foo imported main imported $ python -V Python 2.7.8 I haven't done any tests about the interaction of namespace packages and __main__.py, but if there are additional semantics, they should be documented as well. ---------- _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue24632> _______________________________________