[Zope-dev] Coding style clarifications

Jim Fulton jim at zope.com
Fri Feb 20 10:36:17 EST 2009


On Feb 20, 2009, at 10:22 AM, Martijn Faassen wrote:

> Jim Fulton wrote:
>> On Feb 19, 2009, at 2:07 PM, Marius Gedminas wrote:
>> ...
>>> -1 for repeating
>>> english.adjective.fully english.adverb.qualified  
>>> english.noun.package
>>> english.noun.names all over the place in the code
>>
>> If you have package hierarchies remotely that deep, you have bigger
>> problems.
>
> Dotted name imports within a package's modules like that break the
> ability for people to create package specific namespaces in  
> __init__.py
> due to subtle circular dependency issues. from imports tend to avoid
> this as the namespace package isn't actually needed yet for dotted
> access at a critical point.


Names exported to a containing package cause circular import problems  
whether or not from imports are used.  I've seen from imports make  
this worse. I believe you've seen cases where they make it better.  I  
think the only way to avoid this is to use a deferred import mechanism  
such as zope.deferredimport. (This is one of the few batteries I  
actually wish Python included.)

Jim

--
Jim Fulton
Zope Corporation




More information about the Zope-Dev mailing list