[docs] [issue25294] Absolute imports fail in some cases where relative imports would work

Brett Cannon report at bugs.python.org
Mon Oct 5 18:30:32 CEST 2015

Brett Cannon added the comment:

I don't quite follow what you think is wrong with https://hg.python.org/cpython/file/tip/Lib/concurrent/futures/__init__.py . It looks totally fine to me.

And I should mention that you shouldn't follow PEP 8 like it's in stone and the only way to format code. The PEP is a set of guidelines only and not rules (this is a long-standing position of python-dev on PEP 8). For instance, I don't agree with the absolute import recommendation and do not follow it in my own code nor in importlib (it makes vendoring impossible without modifying the import statements).

I think the key thing to take away from this whole discussion is "don't have circular imports" is the key practice to follow. And if someone wants to propose a patch to update some documentation to point out that `from ... import ...` may work in some situations where `import ...; ... = ...` doesn't then I will personally review such a patch.


Python tracker <report at bugs.python.org>

More information about the docs mailing list