Ronald Oussoren <[email protected]> added the comment:
This has nothing to do with absolute imports at all.
You have two toplevel modules in an entry on sys.path that is before the stdlib
(see the earlier message by Eric V. Smit for documentation on how the path is
initialised). The name of one of those modules shadows the name of a stdlib
module.
Absolute imports are what avoids a similar problem in another situation. Given:
foo/
__init__.py
a.py
math.py
When you import "foo.a" the code in "a.py" is executed as a module in package.
When that code does "import math" absolute imports ensure that this always
references the stdlib version, not the module in the package. Module "foo.a"
should use "from . import math" (relative import) or "import foo.math"
(absolute import) to access functionality in foo.math.
Again, this is not a bug but normal behaviour.
----------
stage: -> resolved
status: open -> closed
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue34414>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com