Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #81006
| Path | csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <ian.g.kelly@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; 'suppose': 0.07; 'function,': 0.09; 'mess': 0.09; 'wrote': 0.14; 'function?': 0.16; 'imports': 0.16; 'modules.': 0.16; 'reusable': 0.16; 'subject:caught': 0.16; 'subject:import': 0.16; 'wrote:': 0.18; 'code.': 0.18; 'module': 0.19; 'basically': 0.19; 'finished': 0.19; '>>>': 0.22; 'import': 0.22; 'putting': 0.22; 'module,': 0.24; 'mon,': 0.24; 'gets': 0.27; 'header:In-Reply-To:1': 0.27; 'function': 0.29; 'message-id:@mail.gmail.com': 0.30; 'code': 0.31; 'another': 0.32; 'subject:the': 0.34; 'could': 0.34; 'problem': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'responsible': 0.36; 'level': 0.37; 'depends': 0.38; 'nov': 0.38; 'needed': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'though,': 0.39; 'to:addr:python.org': 0.39; 'called': 0.40; 'dave': 0.60; 'ian': 0.60; 'first': 0.61; 'such': 0.63; '(that': 0.65; 'ending': 0.78; 'angel': 0.91; 'exposing': 0.91 |
| 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 :content-type; bh=ldCH0km9bgzZtMZiXN6XSX2fT7XmthDS1hpIHieiv9A=; b=ww8vf29gBb2uRRNiHd/ZJ8QIprOfIqn8sr8/zl9nLuwVul8kuVAYrjV5Ky73EoA0Lr 3ndUBjNb8LZW18emK/r9cwUmIKFmuUEQfk4hZoukNi+muzmQ9us2w9qVbQH/AT8M6UQ7 QLDVnxj+lJpG0uBdY7L/PK9n5FCMqQMjnuIv+o0h0w8sKPTl2aQzY4ocW3UAdfV3CD0D i8AhLBspW+GKU4ZsDwyvdTdXH+Sgx566j47dlRPeW0OQRrzKLB+wcDoo3mhW9Qw64/mi ZVIsCTugqcv713f8KcSIzyw+S0IkNPFXQPHqymf7xlFcXS1vqF009kETww3iw3BclRJI B+PQ== |
| X-Received | by 10.70.38.69 with SMTP id e5mr3345454pdk.6.1416324553755; Tue, 18 Nov 2014 07:29:13 -0800 (PST) |
| MIME-Version | 1.0 |
| In-Reply-To | <m4e6t4$hpu$1@ger.gmane.org> |
| References | <m48lfh$n88$1@dont-email.me> <mailman.15871.1416122062.18130.python-list@python.org> <m49omd$924$1@dont-email.me> <mailman.15947.1416208135.18130.python-list@python.org> <m4dki7$fn6$1@dont-email.me> <m4ds4f$dhs$1@ger.gmane.org> <CALwzidnSkhC53oRcWqY_GJi1H=201a+3wm3B7kF44CSO0_yfTA@mail.gmail.com> <m4e6t4$hpu$1@ger.gmane.org> |
| From | Ian Kelly <ian.g.kelly@gmail.com> |
| Date | Tue, 18 Nov 2014 08:28:32 -0700 |
| Subject | Re: caught in the import web again |
| To | Python <python-list@python.org> |
| Content-Type | text/plain; charset=UTF-8 |
| 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 | <https://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 | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.15978.1416324563.18130.python-list@python.org> (permalink) |
| Lines | 28 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1416324563 news.xs4all.nl 2944 [2001:888:2000:d::a6]:48916 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:81006 |
Show key headers only | View raw
On Mon, Nov 17, 2014 at 6:20 PM, Dave Angel <davea@davea.name> wrote: > Ian Kelly <ian.g.kelly@gmail.com> Wrote in message: >> On Mon, Nov 17, 2014 at 3:17 PM, Dave Angel <davea@davea.name> wrote: > >>> In a module that might get tangled in a cycle, avoid global code >>> that depends on other modules. Instead of putting such >>> initialization at top level, put inside a function that gets >>> called after all suspect imports are completed. (That function >>> has global keywords ). >> >> If the problem is that one of those modules would import the current >> module, then "after all suspect imports are completed" basically means >> after the current module has finished importing. So what would be >> responsible for calling such a function? >> > > If one builds a set of modules that cannot avoid recursive > imports, then one can ask the code that imports it to make a call > after importing. Or all that is needed to avoid exposing the mess > is that the top level not be part of the loops. This would make the module less reusable though, since the first other module to import it in one program might still be used in another program but not be the first other module to import it. Or I suppose for simplicity it could be required that all importers call the initialization function, and have the function return immediately if it's been called previously. However, I don't think there's any way to do this without ending up with smelly code.
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
caught in the import web again "Charles T. Smith" <cts.private.yahoo@gmail.com> - 2014-11-15 22:52 +0000
Re: caught in the import web again Ben Finney <ben+python@benfinney.id.au> - 2014-11-16 10:43 +1100
Re: caught in the import web again Denis McMahon <denismfmcmahon@gmail.com> - 2014-11-16 01:11 +0000
Re: caught in the import web again dieter <dieter@handshake.de> - 2014-11-16 08:14 +0100
Re: caught in the import web again "Charles T. Smith" <cts.private.yahoo@gmail.com> - 2014-11-16 08:53 +0000
Re: caught in the import web again Chris Angelico <rosuav@gmail.com> - 2014-11-16 20:20 +1100
Re: caught in the import web again dieter <dieter@handshake.de> - 2014-11-17 08:08 +0100
Re: caught in the import web again "Charles T. Smith" <cts.private.yahoo@gmail.com> - 2014-11-17 20:07 +0000
Re: caught in the import web again Dave Angel <davea@davea.name> - 2014-11-17 17:17 -0500
Re: caught in the import web again Ian Kelly <ian.g.kelly@gmail.com> - 2014-11-17 15:52 -0700
Re: caught in the import web again Dave Angel <davea@davea.name> - 2014-11-17 20:20 -0500
Re: caught in the import web again Ian Kelly <ian.g.kelly@gmail.com> - 2014-11-18 08:28 -0700
Re: caught in the import web again Dave Angel <davea@davea.name> - 2014-11-18 14:09 -0500
Re: caught in the import web again Chris Angelico <rosuav@gmail.com> - 2014-11-19 07:18 +1100
Re: caught in the import web again Dave Angel <davea@davea.name> - 2014-11-18 17:58 -0500
Re: caught in the import web again Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-11-18 09:45 +1100
Re: caught in the import web again Rick Johnson <rantingrickjohnson@gmail.com> - 2014-11-17 18:17 -0800
Re: caught in the import web again Chris Angelico <rosuav@gmail.com> - 2014-11-18 13:25 +1100
Re: caught in the import web again Steven D'Aprano <steve@pearwood.info> - 2014-11-18 07:13 +0000
Re: caught in the import web again Michael Torrie <torriem@gmail.com> - 2014-11-18 00:00 -0700
Re: caught in the import web again "Charles T. Smith" <cts.private.yahoo@gmail.com> - 2014-11-18 09:13 +0000
csiph-web