Barry A. Warsaw added the comment:
More rationale from the thread:
The surprising part is that it also happens for explicit relative
imports. I'm guessing that part was unintentional and simply not
noticed when PEP 328 was implemented.
No, that must also have been intentional, because
New submission from Barry A. Warsaw:
As described here:
http://news.gmane.org/find-root.php?message_id=20150422115959.1ff2ee58%40limelight.wooz.org
Importing a submodule binds the submodule's name in the parent module's
namespace. This is surprising, but it seems intentional and it's relied
Barry A. Warsaw added the comment:
From Guido:
It's definitely intentional, and it's fundamental to the package import
design. We've had many implementations of package import (remember ni.py?
last seen as knee.py) and it was always there, because this is done as
part of *submodule loading*.
Eric Snow added the comment:
Guido describes the global invariant for *all* the forms of importing a
submodule, including explicit relative imports:
I just mean that for relative import
there is no need to bind the submodule to the parent, is there?
But there *is* a reason. The submodule
Barry A. Warsaw added the comment:
Here's some new text for the Language Reference.
--
Added file: http://bugs.python.org/file39175/issue24029-1.txt
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue24029
Roundup Robot added the comment:
New changeset 3968e7a9614c by Barry Warsaw in branch '3.4':
Issue #24029: Document the name binding behavior for submodule imports.
https://hg.python.org/cpython/rev/3968e7a9614c
New changeset 351ad8c4f3a6 by Barry Warsaw in branch '3.4':
Issue #24029: Document
Barry A. Warsaw added the comment:
Cool, thanks! I'll commit it and we can always clean it up/add to it later if
needed.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue24029
___
Changes by Barry A. Warsaw ba...@python.org:
--
resolution: - fixed
status: open - closed
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue24029
___
Eric Snow added the comment:
LGTM. You've covered all the key points and the example is good.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue24029
___