Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #20942
| 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!newsfeed6.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <prvs=3974d0729=jeanmichel@sequans.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.043 |
| X-Spam-Evidence | '*H*': 0.91; '*S*': 0.00; 'imports': 0.07; 'lost.': 0.09; 'circular': 0.15; 'altogether.': 0.16; 'nail': 0.16; 'refactoring': 0.16; 'uncommon': 0.16; 'cc:addr:python-list': 0.16; 'wrote:': 0.18; 'subject:Question': 0.19; 'cc:no real name:2**0': 0.21; 'trying': 0.21; 'header:In-Reply-To:1': 0.22; 'cc:2**0': 0.26; 'module': 0.26; 'code': 0.26; 'import': 0.27; 'rid': 0.29; 'cc:addr:python.org': 0.29; 'seem': 0.29; 'there': 0.33; 'header:User-Agent:1': 0.33; 'all.': 0.34; 'anything': 0.34; 'something': 0.35; 'question': 0.36; 'but': 0.37; 'doing': 0.38; 'think': 0.38; 'possible,': 0.39; 'except': 0.39; "you've": 0.61; 'address': 0.61; 'frank': 0.64; 'battle': 0.84; 'outset': 0.84; 'unavoidable': 0.84; 'recurring': 0.93 |
| X-IronPort-AV | E=Sophos;i="4.73,491,1325458800"; d="scan'208";a="194797" |
| X-Virus-Scanned | amavisd-new at zimbra.sequans.com |
| Date | Mon, 27 Feb 2012 15:59:52 +0100 |
| From | Jean-Michel Pichavant <jeanmichel@sequans.com> |
| User-Agent | Mozilla-Thunderbird 2.0.0.24 (X11/20100328) |
| MIME-Version | 1.0 |
| To | Frank Millman <frank@chagford.com> |
| Subject | Re: Question about circular imports |
| References | <jid2a9$n21$1@dough.gmane.org> |
| In-Reply-To | <jid2a9$n21$1@dough.gmane.org> |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| Content-Transfer-Encoding | 7bit |
| Cc | python-list@python.org |
| 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.201.1330354794.3037.python-list@python.org> (permalink) |
| Lines | 29 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1330354794 news.xs4all.nl 6871 [2001:888:2000:d::a6]:60334 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:20942 |
Show key headers only | View raw
Frank Millman wrote: > Hi all > > I seem to have a recurring battle with circular imports, and I am trying to > nail it once and for all. > > Let me say at the outset that I don't think I can get rid of circular > imports altogether. It is not uncommon for me to find that a method in > Module A needs to access something in Module B, and a method in Module B > needs to access something in Module A. I know that the standard advice is to > reorganise the code to avoid this, and I try to do this where possible, but > for now I would like to address the question of how to handle the situation > if this is otherwise unavoidable. > Hi Frank, If you consider it unavoidable you've already lost. There is no reliable solution to circular import except refactoring the code to place all common code elsewhere: wavbase.py wavread.py (import wavbase) wavwrite.py (import wavbase) Any code required by both waread and wavwrite would end up in wavbase. Is there anything that prevent you from doing this ? JM
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Question about circular imports Jean-Michel Pichavant <jeanmichel@sequans.com> - 2012-02-27 15:59 +0100
csiph-web