Velocity Reviews

Velocity Reviews (
-   Python (
-   -   Re: How to improve the usability of nested packages (

Stefan H. Holek 11-02-2012 06:23 PM

Re: How to improve the usability of nested packages
Hi Michael,

What we have learned from creating the Zope Toolkit (formerly Zope 3), is that files in namespace packages should be empty, and imports should be absolute. [1]

That said, there are ways to avoid import cycles. One is to very carefully craft your modules so they do not have to import from each other. Another is to not have imports at the module level, but move them into the functions where they are required. Third, large libraries like the Zope Toolkit usually have mechanisms to defer imports to some point after initial loading. You may want explore this direction as well. [2]

(Not trying to plug the ZTK here, it just happens to be a large, namespace-using library I know.)

Hope this helps,


Stefan H. Holek

All times are GMT. The time now is 09:23 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.