are there any guidelines / best practises for setting the contents of __init__.py, interfaces.py, and the packages that they import or that they expose? there are too many alternatives and too many ways of ending up doing circular imports and I'd like to have a consistent pattern for reducing that risk.

but there doesn't seem to be a 100% clear pattern to follow when looking at the zope3 code base:

some packages in have all the implementation code in __init__.py, others have it in a file and the imports are done in __init__.py, others import files starting with an underscore (to make them private I suppose).

some packages have an interfaces.py file others have a "interfaces" folder, others have the interface definitions in the implementation code itself ...

Jim mentioned to me that only public and official interface definitions should be listed in 'interfaces', the others should be defined inline with the implementation - are there guidelines to follow?

I like the inline option because it reduces the amount of imports and the risk for import cycles. Does it mean that interfaces should be defined inline with the code and those that are "official" be imported from intertaces.py? It sounds like a good pattern.

Zope3-dev mailing list
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com

Reply via email to