How to improve the usability of nested packages

Michael Schwarz at
Sat Nov 3 10:26:32 CET 2012

Hi Stefan

On 2012-W44-5, at 19:23, Stefan H. Holek wrote:

> 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.

I've also thought about that. I do not like the fact that I then need to educate the other developers about minute details of the import machinery just so they can add code to the library. I'm currently the only developer doing actual work in Python and would like to make the transition as painless as possible.

> 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]

Hmm, I like the idea but sadly it doesn't look very IDE-friendly.

Thanks for your tips!

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2227 bytes
Desc: not available
URL: <>

More information about the Python-list mailing list