[Python-Dev] status of absolute_import w/ python 2.7
Nick Coghlan
ncoghlan at gmail.com
Wed Jul 13 06:40:50 CEST 2011
On Wed, Jul 13, 2011 at 1:41 PM, Brett Cannon <brett at python.org> wrote:
> So are you claiming that the import of 'package' w/o the __future__
> statement actually succeeds even though there is no package.subpackage
> module? Obviously that would be a flat-out bug, but I just double-checked my
> sanity and that does nto work with a CPython 2.7 checkout.
No, the problem is that __future__.absolute_import claims to be the
default behaviour in 2.7, but this does not appear to actually be the
case - it still tries the implicit relative import. E.g, given the
following setup:
cwd
/package
/__init__.py
/submodule.py
/submodule2.py
an "import submodule" in __init__.py or submodule2.py will succeed.
Now, the what's new for 2.7 doesn't actually *say* we made that change
and I can't find any evidence for it in NEWS either, so I think the
bug is actually in the __future__ module (and docs:
http://docs.python.org/library/__future__).
Cheers,
Nick.
--
Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia
More information about the Python-Dev
mailing list