Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #80989
| From | Dave Angel <davea@davea.name> |
|---|---|
| Subject | Re: caught in the import web again |
| Date | 2014-11-17 20:20 -0500 |
| Organization | news.gmane.org |
| References | (2 earlier) <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> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.15965.1416273652.18130.python-list@python.org> (permalink) |
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. -- DaveA
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