Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #20978
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!news.stack.nl!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <python-python-list@m.gmane.org> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.006 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'package,': 0.03; 'api.': 0.05; 'imports': 0.07; 'answering': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'api': 0.09; 'circular': 0.15; '"frank': 0.16; 'altogether.': 0.16; 'thread.': 0.16; 'subject:Question': 0.19; 'seems': 0.20; 'wrote': 0.21; 'module': 0.26; 'work.': 0.27; 'import': 0.27; 'putting': 0.28; 'fails,': 0.30; 'idea': 0.32; 'there': 0.33; 'test': 0.34; 'header:X-Complaints-To:1': 0.34; 'follow-up': 0.34; 'sense,': 0.34; 'was,': 0.34; 'to:addr:python- list': 0.35; '...': 0.35; '(for': 0.35; 'question': 0.36; 'received:org': 0.36; 'created': 0.37; 'run': 0.37; 'but': 0.37; 'some': 0.38; 'problems': 0.38; 'that.': 0.39; 'called': 0.40; 'put': 0.40; 'to:addr:python.org': 0.40; 'quick': 0.61; 'frank': 0.64; 'objective': 0.64; 'directly.': 0.68; 'received:41': 0.71; 'concept': 0.74; 'subject,': 0.91 |
| X-Injected-Via-Gmane | http://gmane.org/ |
| To | python-list@python.org |
| From | "Frank Millman" <frank@chagford.com> |
| Subject | Re: Question about sub-packages |
| Date | Tue, 28 Feb 2012 14:44:48 +0200 |
| References | <jii0vo$36t$1@dough.gmane.org> |
| X-Gmane-NNTP-Posting-Host | 41-133-114-166.dsl.mweb.co.za |
| X-MSMail-Priority | Normal |
| X-Newsreader | Microsoft Outlook Express 6.00.3790.4657 |
| X-RFC2646 | Format=Flowed; Response |
| X-MimeOLE | Produced By Microsoft MimeOLE V6.00.3790.4913 |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.12 |
| 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.226.1330433101.3037.python-list@python.org> (permalink) |
| Lines | 36 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1330433101 news.xs4all.nl 6984 [2001:888:2000:d::a6]:51677 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:20978 |
Show key headers only | View raw
"Frank Millman" <frank@chagford.com> wrote in message news:jii0vo$36t$1@dough.gmane.org... > Hi all > > This is a follow-up to my recent question about circular imports, but on a > different subject, hence the new thread. > [...] > > If this makes sense, my next thought was, where is the best place to put > this API. Then I thought, why not put it in the __init__.py of the > sub-package? Then all that the users of the package have to do is import > the package, and then place calls on it directly. > > I did a quick test and it seems to work. Is this a good idea, or are there > any downsides? > Answering my own question again ... The one-liner API concept *may* be a good idea - still waiting for some feedback on that. But putting them into __init__.py is not a good idea, as I run into some subtle 'circular import' problems again. I don't fully understand the conditions under which it fails, but that is unimportant, as my objective is to avoid circular imports altogether. I have created a module called 'api.py' and put them in there, and that seems to work (for now...). Frank
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Question about sub-packages "Frank Millman" <frank@chagford.com> - 2012-02-28 14:44 +0200
csiph-web