Mutual interdependency problem

AdSR artur_spruce at yahoo.com
Wed Jun 7 17:40:51 EDT 2006


Jeremy Sanders wrote:
> I'm getting problems with modules with interdependencies when using the
> import form "import foo.bar as bar".
>
> [snip]
>
> Maybe the "from foo import *" style in __init__.py is a bad idea, but it
> allows you to expose a flat namespace without having to put all the code
> into one file. Then naturally you need mutual interdependencies, and then
> it breaks! I can work around it by removing the "as XXX" parts on the
> import statement, but it gets annoying having to specify the full path.

What worries me is that you have two modules that import each other.
Are you sure you can't do it any other way?

AdSR




More information about the Python-list mailing list