[Zope3-dev] __init__.py interfaces.py guidelines?

Jim Fulton jim at zope.com
Mon Nov 21 07:32:19 EST 2005


Janko Hauser wrote:
> 
> Am 21.11.2005 um 12:15 schrieb Martijn Faassen:
> 
>> My recommendations for any guidelines would be:
>>
>> * use namespace packages, so nothing (or very minimal stuff only,  
>> like a few imports) in __init__.py. I think this is recommended  
>> practice outside of Zope 3 as well, so we should stick with this.  
>> Twisted seems to have small or empty __init__.py packages for  
>> instance, and so does PEAK, to compare with some other large  
>> frameworks in Python.
>>
>> * use interfaces.py and put interfaces there unless there's a very  
>> good reason it should be private (which is rare).
> 
> 
> I'm in support of all the suggestions Martijn has written. As a small  
> addition I sometimes use a subdirectory interfaces with some modules,  
> when I have many classes with different concerns in a namespace. But  in 
> the interfaces subdirectory I use __init__.py to import  everything, so 
> that for interface imports elsewhere it looks all the  same.

I strongly suspect that when you do this, you should really split the package
up.

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 Zope3-dev mailing list