I just ran into the issue described in 
http://stackoverflow.com/questions/6351805/cyclic-module-dependencies-and-relative-imports-in-python.

This is unfortunate, because we have been trying to move towards relative 
imports in order to aid flexibility in package and library design.

The relative import syntax

  (from foo import bar) is a getattr type of lookup (i.e. import foo, then get 
attr from it).

This is in contrast with absolute import

  import foo.bar  (get the module foo.bar from sys.modules or import it)

  bar = foo.bar



the latter works with partially initialized modules, but not the former, 
rendering two sibling modules unable to import each other using the relative 
syntax.



as far as I know, relative imports are only supported using the former (import 
from) syntax.  Are there any plans to alleviate this by allowing proper 
relative imports?  After all, relative imports and packages go hand in hand.



K


_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to