[Zope-dev] Coding style clarifications

Martijn Faassen faassen at startifact.com
Fri Feb 20 14:11:08 EST 2009


Christian Theune wrote:
> On Fri, 2009-02-20 at 18:18 +0100, Martijn Faassen wrote:
>> We discovered this when Christian Theune said he wanted his package 
>> __init__.py empty as otherwise he runs into circular import issues. Some 
>> of the others including myself were puzzled as we put APIs in 
>> __init__.py quite frequently without such problems. Turned out it was 
>> because he is using the same convention for imports you do, and we weren't.
> 
> The conclusion that I took from that round was that either approach
> works reasonably well (with its own limitations) by itself, but mixing
> them increases the chance for import problems a lot.

Yes.

The from import method supports putting an API in __init__.py while the 
other method does not (unless, I imagine, deferred import is used). The 
import dotted.name method allows, well, itself.

Seems people just gravitated to each pole according to their 
preferences, and find out the other approach causes problems. :)

Regards,

Martijn



More information about the Zope-Dev mailing list