Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Re: How to improve the usability of nested packages

Reply
Thread Tools

Re: How to improve the usability of nested packages

 
 
Stefan H. Holek
Guest
Posts: n/a
 
      11-02-2012
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


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
How to improve the usability of nested packages Michael Schwarz Python 1 11-06-2012 04:02 AM
Re: How to improve the usability of nested packages Terry Reedy Python 0 11-02-2012 05:56 PM
Search Engine Optimization Packages India, SEO Packages Hyderabad,SEO Packages Firm visioninfosyslinks@gmail.com HTML 0 12-20-2007 08:45 AM
Do the javax.imageio packages replace packages in com.sun.image? Paul Smith Java 0 11-18-2003 02:58 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57