[Python-Dev] Circular imports considered harmful (was import.c)
Jim Fulton
jim at zope.com
Fri May 28 17:09:46 EDT 2004
Tim Peters wrote:
> Does anyone living understand import.c in all its gory glory now?
>
...
> 2. Zope3 in particular is having horrid problems with circular
> imports. These are also a bitch to track down. I'm not sure
> it was any better in Zope2, but Zope3 has been undergoing
> frequent and massive refactorings (and a new round of unintended
> circular imports creates subtle problems each time).
I wouldn't put it quite that dramatically, but it's bad enough
that I've asked Fred to put together a tool to detect circular
imports as part of our testing framework. The problems with circular
imports, at least in a large system like Zope 3, are:
- They often work
- Whether or not they work can depend on the order
that you import seemingly unrelated modules.
- Often, by the time they fail, you've unwittingly created a rat's
nest that's a pain to untangle.
I think just having a tool to easily detect them will be a major step
forward.
Jim
--
Jim Fulton mailto:jim at zope.com Python Powered!
CTO (540) 361-1714 http://www.python.org
Zope Corporation http://www.zope.com http://www.zope.org
More information about the Python-Dev
mailing list