Ronan Lamy <[email protected]> added the comment:
my_pkg.__init__ isn't treated as just another module but as a package. That is
the reason why the bogus my_pkg.__init__.module1 is created, I guess:
>>> import sys
>>> sorted(name for name in sys.modules if name.startswith('my_'))
[]
>>> import my_pkg.__init__
>>> sorted(name for name in sys.modules if name.startswith('my_'))
['my_pkg', 'my_pkg.__init__', 'my_pkg.__init__.module1', 'my_pkg.module1',
'my_pkg.module2']
>>> sys.modules['my_pkg.module1'].__package__
'my_pkg'
>>> sys.modules['my_pkg.__init__'].__package__
'my_pkg.__init__'
I agree that importing __init__ is a hack, but the way 3.3 reacts to it is
nasty, because it can cause a whole application to be executed multiple times.
----------
resolution: wont fix ->
status: closed -> open
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue14938>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com