[Zope-dev] Coding style clarifications

Jim Fulton jim at zope.com
Fri Feb 20 11:05:38 EST 2009


On Feb 20, 2009, at 11:00 AM, Martijn Faassen wrote:
...
> The main take-home message was that the import mechanics of Python are
> rather surprising in operation here and it's very hard to reason about
> it. It has something to do with 'foo'" having to be more initialized
> during importing than in the other case. I do know that the pattern of
> 'from' imports in a package's module will allow me to write a
> __init__.py assembling a namespace from sub-modules, while the pattern
> of "import foo.bar" in a package's module will give circular import
> related errors. "foo" in the latter case will have to be a more
> complete object.


You will still likely have other problems unless you use deferred  
imports which will generally solve this problem in a robust way.

Jim

--
Jim Fulton
Zope Corporation




More information about the Zope-Dev mailing list