Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #32691

Re: How to improve the usability of nested packages

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!newsfeed.eweka.nl!eweka.nl!feeder3.eweka.nl!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <michi.schwarz@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.014
X-Spam-Evidence '*H*': 0.97; '*S*': 0.00; 'level,': 0.07; 'subject:How': 0.09; 'python': 0.09; '[1]:': 0.09; 'craft': 0.09; 'imports': 0.09; 'defer': 0.16; 'sadly': 0.16; 'third,': 0.16; 'wrote:': 0.17; 'stefan': 0.17; 'developer': 0.19; 'module': 0.19; 'import': 0.21; 'libraries': 0.22; 'required.': 0.22; "i've": 0.23; 'idea': 0.24; 'header:In-Reply-To:1': 0.25; 'developers': 0.26; '[2]': 0.27; 'library.': 0.27; 'transition': 0.27; "doesn't": 0.28; 'actual': 0.28; 'initial': 0.28; 'received:10.0.0': 0.28; 'toolkit': 0.29; "i'm": 0.29; 'that.': 0.30; 'usually': 0.30; 'code': 0.31; 'point': 0.31; 'url:zope': 0.33; 'received:10.0': 0.33; 'to:addr:python-list': 0.33; 'another': 0.33; 'received:google.com': 0.34; 'thanks': 0.34; 'direction': 0.35; 'said,': 0.35; 'doing': 0.35; 'there': 0.35; 'add': 0.36; 'michael': 0.36; 'but': 0.36; 'message- id:@gmail.com': 0.36; 'received:74.125': 0.36; 'url:org': 0.36; 'modules': 0.36; 'charset:us-ascii': 0.36; 'well.': 0.37; 'subject:: ': 0.38; 'fact': 0.38; 'some': 0.38; 'possible.': 0.38; 'url:docs': 0.38; 'received:10': 0.38; 'to:addr:python.org': 0.39; 'where': 0.40; 'header:Received:5': 0.40; 'your': 0.60; 'header :Message-Id:1': 0.62; 'details': 0.63; 'other.': 0.64; 'carefully': 0.71; 'cycles.': 0.84; 'subject:improve': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:mime-version:content-type:subject:date:in-reply-to:to :references:message-id:x-mailer; bh=o1k4mIiXP4ZXvDH9x2pm822z6S+8/HKeqBdbE7rj4cQ=; b=N1C+Uork15GaAj44PT6BsWEmml00Ach4OhrIwyuVPBU7n/quGw6161FrGPlCkHoo23 FFxP5NM+cmRBkz7H5c/b++YCrWNnmJ537AMwlN3y29bPvVL2QFieo3OJYGY3VrRfCVZ1 lshoPyuGaZkNP9kMjkldark1ufaDhFU3wsbW/CCi0gH+A+pigK/Pg26lkD3PRPrzU3x4 Lj6f4xF7mW71UyvUqoM4jy67TZaZ0SZG+sLMg2CvBGhcs3Jf5DrETwIhKtUf68P4AyRJ xXZEC6qgrd3Xceh0TCU/mBdFKcMlAFqOzxpZ311DUJKN4bH5bMxQi6rwOe9xp3hiewC5 QJlg==
From Michael Schwarz <michi.schwarz@gmail.com>
Mime-Version 1.0 (Apple Message framework v1085)
Content-Type multipart/signed; boundary=Apple-Mail-2--34562038; protocol="application/pkcs7-signature"; micalg=sha1
Subject Re: How to improve the usability of nested packages
Date Sat, 3 Nov 2012 10:26:32 +0100
In-Reply-To <5F9CBDF7-2142-4B4E-9EA8-4E1A10777FE5@epy.co.at>
To python-list@python.org
References <CABdB9Z5sGS4XNw5D7qvq5KciJMHHZrx8WUr4D6ZreqPEVRkCNQ@mail.gmail.com> <5F9CBDF7-2142-4B4E-9EA8-4E1A10777FE5@epy.co.at>
X-Mailer Apple Mail (2.1085)
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.3238.1351934797.27098.python-list@python.org> (permalink)
Lines 81
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1351934797 news.xs4all.nl 6902 [2001:888:2000:d::a6]:48525
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:32691

Show key headers only | View raw


[Multipart message — attachments visible in raw view] - view raw

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!
Michael

[1]: http://docs.zope.org/zopetoolkit/codingstyle/python-style.html

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: How to improve the usability of nested packages Michael Schwarz <michi.schwarz@gmail.com> - 2012-11-03 10:26 +0100

csiph-web