Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #32646 > unrolled thread
| Started by | "Stefan H. Holek" <stefan@epy.co.at> |
|---|---|
| First post | 2012-11-02 19:23 +0100 |
| Last post | 2012-11-02 19:23 +0100 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: How to improve the usability of nested packages "Stefan H. Holek" <stefan@epy.co.at> - 2012-11-02 19:23 +0100
| From | "Stefan H. Holek" <stefan@epy.co.at> |
|---|---|
| Date | 2012-11-02 19:23 +0100 |
| Subject | Re: How to improve the usability of nested packages |
| Message-ID | <mailman.3216.1351880590.27098.python-list@python.org> |
Hi Michael, What we have learned from creating the Zope Toolkit (formerly Zope 3), is that __init__.py 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 [1] http://docs.zope.org/zopetoolkit/ [2] http://pypi.python.org/pypi/zope.deferredimport -- Stefan H. Holek stefan@epy.co.at
Back to top | Article view | comp.lang.python
csiph-web