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

Patrick Maupin report at bugs.python.org
Mon Oct 5 19:11:44 CEST 2015


Patrick Maupin added the comment:

I don't think anything is wrong with that code.  But PEP 8 prescribes a way of doing something that often won't work (which is unusual for PEP 8), with no discussion of this fact.

> I think the key thing to take away from this whole discussion is "don't have circular imports" is the key practice to follow.

If this is a "key practice" then why the heck is the recommended way to do things the one that is guaranteed to break it?

I have empirical evidence that it is surprising to some users that the semantics of "from .z import foo" and "from x.y.z import foo" are not identical -- in other words, some of them have a hard time classifying the second as a circular import but not the first.  And the documentation is silent on this.

> And if someone wants to propose a patch to update some documentation

I'll try to get to this in the next couple of weeks.

Thanks,
Pat

----------

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


More information about the docs mailing list