[issue14938] 'import my_pkg.__init__' creates duplicate modules

Brett Cannon report at bugs.python.org
Thu May 31 17:30:06 CEST 2012


Brett Cannon <brett at python.org> added the comment:

I see what you mean about the discrepancy, but you don't need to complicate the constructor to get the desired result. If you have is_package() check if the module name ends in __init__ to skip the package check and just say False (e.g. only if the path ends in __init__ but the module name does not) then you will get your desired semantics out of is_package (since this is what find_loader() is doing).

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue14938>
_______________________________________


More information about the Python-bugs-list mailing list