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


Groups > comp.lang.python > #49871

Re: Coping with cyclic imports

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <oscar.j.benjamin@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.009
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'importing': 0.05; '(so': 0.07; 'referring': 0.07; 'responding': 0.07; 'cc:addr:python- list': 0.11; '"from': 0.16; 'cyclic': 0.16; 'exists)': 0.16; 'fine.': 0.16; 'foo"': 0.16; 'foo,': 0.16; 'runs,': 0.16; 'thread?': 0.16; 'wrote:': 0.18; 'module': 0.19; 'import': 0.22; 'cc:addr:python.org': 0.22; 'question': 0.24; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; 'compiled': 0.26; 'references': 0.26; 'post': 0.26; 'header:In-Reply-To:1': 0.27; 'message- id:@mail.gmail.com': 0.30; 'problem': 0.35; 'subject:with': 0.35; 'advice': 0.35; 'created': 0.35; 'received:google.com': 0.35; 'there': 0.35; '2008': 0.38; 'previous': 0.38; 'anything': 0.39; 'quote': 0.39; "you're": 0.61; 'back': 0.62; "you've": 0.63; 'name': 0.63; 'july': 0.63; 'to:addr:gmail.com': 0.65; 'other.': 0.75; 'oscar': 0.84; '2013': 0.98
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=nNYASQTYALCsN/jj9hHZl65T+RqO8RK/uAJyVavt/8Q=; b=BtFcXF9QzI1Mt1udbDYJe9KvpZr5zyG0NShrcMJ2SDk40jS2nhNQ8mlqY1aRmzbvhM Q96008R3J4lvvrVa3wn2yFM8tdc6Ll0jnqXA7PO3vdWTY7kOeYZvOXfgiDQButFiiJ/M Ec8/i8VhjIVslKtDFfs18UccrgcGixeyXBGoJauQW4Djz85hdGyvKAMEDUTHIgNoLVM3 o5o1uyWBbI1KkHcHgRUQoJcy3zt+Bkba9dDvYh+k1UlaKFmi+X7y1HbXRGLDb0NjJ4GE OUF9Q8uyIo5M1GDLVCWd2zNzUSC1/1CIFRLnyGflFryWVgRiDp+OkKzULlnkTnU+/33o 8u4w==
X-Received by 10.58.207.103 with SMTP id lv7mr3355198vec.33.1372950220329; Thu, 04 Jul 2013 08:03:40 -0700 (PDT)
MIME-Version 1.0
In-Reply-To <bc7429c5-7771-4529-9554-f494f393cbb6@googlegroups.com>
References <87bq4knmax.fsf@physik.rwth-aachen.de> <bc7429c5-7771-4529-9554-f494f393cbb6@googlegroups.com>
From Oscar Benjamin <oscar.j.benjamin@gmail.com>
Date Thu, 4 Jul 2013 16:03:20 +0100
Subject Re: Coping with cyclic imports
To kanchan.n.mahajan@gmail.com
Content-Type text/plain; charset=ISO-8859-1
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.4236.1372950228.3114.python-list@python.org> (permalink)
Lines 19
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1372950228 news.xs4all.nl 15999 [2001:888:2000:d::a6]:47999
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:49871

Show key headers only | View raw


On 4 July 2013 13:48,  <kanchan.n.mahajan@gmail.com> wrote:
> On Tuesday, April 8, 2008 10:06:46 PM UTC+2, Torsten Bronger wrote:
[snip]
>
> If you do "import foo" inside bar and "import bar" inside foo, it will work fine. By the time anything actually runs, both modules will be fully loaded and will have references to each other.
>
> The problem is when instead you do "from foo import abc" and "from bar import xyz". Because now each module requires the other module to already be compiled (so that the name we are importing exists) before it can be compiled.
>
> from
> http://stackoverflow.com/questions/744373/circular-or-cyclic-imports-in-python

Is there some reason you're responding to a post from 5 years ago?

Or is it just a joke that you've created a cyclic import advice link
by referring to a SO question where the top answer is actually a quote
linking back to the previous post in this same thread?


Oscar

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


Thread

Re: Coping with cyclic imports kanchan.n.mahajan@gmail.com - 2013-07-04 05:48 -0700
  Re: Coping with cyclic imports Dave Angel <davea@davea.name> - 2013-07-04 09:33 -0400
  Re: Coping with cyclic imports Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2013-07-04 16:03 +0100
    Re: Coping with cyclic imports kanchan.n.mahajan@gmail.com - 2013-07-04 08:11 -0700
      Re: Coping with cyclic imports Dave Angel <davea@davea.name> - 2013-07-04 18:12 -0400

csiph-web