Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #32646
| Path | csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder1.xlned.com!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <stefan@epy.co.at> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.002 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'url:pypi': 0.03; 'level,': 0.07; 'subject:How': 0.09; '3),': 0.09; 'craft': 0.09; 'empty,': 0.09; 'imports': 0.09; 'namespace': 0.09; 'plug': 0.09; 'cc:addr :python-list': 0.10; 'library': 0.15; '__init__.py': 0.16; 'defer': 0.16; 'michael,': 0.16; 'third,': 0.16; 'stefan': 0.17; 'module': 0.19; '(not': 0.20; 'trying': 0.21; 'import': 0.21; 'large,': 0.22; 'libraries': 0.22; 'required.': 0.22; 'cc:2**0': 0.23; 'cc:no real name:2**0': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'creating': 0.26; '[1]': 0.27; '[2]': 0.27; 'initial': 0.28; 'received:192.168.1.3': 0.29; 'toolkit': 0.29; 'usually': 0.30; 'point': 0.31; 'url:python': 0.32; 'url:zope': 0.33; 'another': 0.33; 'direction': 0.35; 'said,': 0.35; 'there': 0.35; 'but': 0.36; 'url:org': 0.36; 'modules': 0.36; 'should': 0.36; 'charset:us-ascii': 0.36; 'well.': 0.37; 'subject:: ': 0.38; 'files': 0.38; 'some': 0.38; 'url:docs': 0.38; 'received:192': 0.39; 'where': 0.40; 'received:192.168': 0.40; 'your': 0.60; 'header:Message-Id:1': 0.62; 'skip:n 10': 0.63; 'other.': 0.64; 'learned': 0.65; 'carefully': 0.71; 'received:at': 0.71; 'cycles.': 0.84; 'subject:improve': 0.84 |
| Subject | Re: How to improve the usability of nested packages |
| Mime-Version | 1.0 (Apple Message framework v1085) |
| Content-Type | text/plain; charset=us-ascii |
| From | "Stefan H. Holek" <stefan@epy.co.at> |
| In-Reply-To | <CABdB9Z5sGS4XNw5D7qvq5KciJMHHZrx8WUr4D6ZreqPEVRkCNQ@mail.gmail.com> |
| Date | Fri, 2 Nov 2012 19:23:00 +0100 |
| Content-Transfer-Encoding | quoted-printable |
| References | <CABdB9Z5sGS4XNw5D7qvq5KciJMHHZrx8WUr4D6ZreqPEVRkCNQ@mail.gmail.com> |
| To | Michael Schwarz <michi.schwarz@gmail.com> |
| X-Mailer | Apple Mail (2.1085) |
| Cc | python-list@python.org |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.3216.1351880590.27098.python-list@python.org> (permalink) |
| Lines | 26 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1351880590 news.xs4all.nl 6912 [2001:888:2000:d::a6]:36795 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:32646 |
Show key headers only | View raw
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 comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: How to improve the usability of nested packages "Stefan H. Holek" <stefan@epy.co.at> - 2012-11-02 19:23 +0100
csiph-web