Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #7668
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!weretis.net!feeder4.news.weretis.net!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <SRS0=ISUf=ZE=ieee.org=davea@srs.perfora.net> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.016 |
| X-Spam-Evidence | '*H*': 0.97; '*S*': 0.00; 'subject:module': 0.04; 'names.': 0.07; 'script,': 0.07; 'pm,': 0.10; 'wrote:': 0.14; 'defined': 0.14; 'cc:addr:benfinney.id.au': 0.16; 'cc:name:ben finney': 0.16; 'elsewhere,': 0.16; 'risk,': 0.16; 'risks,': 0.16; 'wind': 0.16; 'cc:addr:python-list': 0.17; 'importing': 0.19; 'script.': 0.19; 'yet.': 0.19; 'tree': 0.19; 'header:In-Reply- To:1': 0.21; 'stuff': 0.22; 'cc:no real name:2**0': 0.23; 'module,': 0.23; 'code': 0.24; 'modules': 0.26; 'not.': 0.26; 'pass': 0.27; 'script': 0.27; 'problem': 0.28; 'import': 0.29; 'cc:addr:python.org': 0.30; 'module': 0.30; 'imported': 0.30; 'modules,': 0.30; 'calling': 0.31; 'things': 0.33; "i've": 0.33; 'thinking': 0.34; 'there': 0.35; 'header:User-Agent:1': 0.35; 'module.': 0.35; 'cc:2**1': 0.35; 'certain': 0.36; 'case': 0.37; 'another': 0.37; 'pretty': 0.37; 'two': 0.37; 'run': 0.38; 'eric': 0.38; 'subject:: ': 0.38; 'received:192': 0.38; 'doing': 0.39; 'should': 0.39; 'getting': 0.40; 'really': 0.40; 'received:192.168.1': 0.40; 'watch': 0.60; 'custom': 0.60; 'your': 0.60; 'order': 0.62; 'back': 0.63; 'ways,': 0.67; 'header:Reply- To:1': 0.72; 'reply-to:no real name:2**0': 0.72; '(once': 0.84; '02:59': 0.84; 'snow': 0.91 |
| Date | Wed, 15 Jun 2011 00:02:05 -0400 |
| From | Dave Angel <davea@ieee.org> |
| User-Agent | Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110516 Thunderbird/3.1.10 |
| MIME-Version | 1.0 |
| To | Eric Snow <ericsnowcurrently@gmail.com> |
| Subject | Re: break in a module |
| References | <BANLkTinfUsHXuF5j5XjTMhiQXQKNi4ZSGA@mail.gmail.com> <4DF7E75E.9000907@mrabarnett.plus.com> <mailman.240.1308093309.11593.python-list@python.org> <qaWdnQmQzemLaWrQnZ2dnUVZ5vidnZ2d@giganews.com> <mailman.247.1308099095.11593.python-list@python.org> <87k4cnswt9.fsf@benfinney.id.au> <BANLkTinaxP039xcOvshXZZUoV4b3zxhKjg@mail.gmail.com> |
| In-Reply-To | <BANLkTinaxP039xcOvshXZZUoV4b3zxhKjg@mail.gmail.com> |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-Provags-ID | V02:K0:EQa7GL52qgbvbNu/fScsuSQsiFvC93cP4UUqooi+wfL 2DWn5o2CQnD1W7V46OxA0gtML9n7Rtl0v5C9p0B9lj2Hu7c7g4 Ms/tv2B/amzuI0a+79glI2ujItFr1wNeHZzLetccPnMNwJLR27 YzazFMku23uTYY506f2UrH80F/xO7+102E1bla1Mobpozn/j9D cc2Tfre6COq5+DB3bYnNQ== |
| Cc | python-list@python.org, Ben Finney <ben+python@benfinney.id.au> |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.12 |
| Precedence | list |
| Reply-To | davea@ieee.org |
| 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.253.1308110548.11593.python-list@python.org> (permalink) |
| Lines | 29 |
| NNTP-Posting-Host | 82.94.164.166 |
| X-Trace | 1308110548 news.xs4all.nl 49181 [::ffff:82.94.164.166]:49476 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:7668 |
Show key headers only | View raw
On 01/-10/-28163 02:59 PM, Eric Snow wrote: > <snip> > > Unfortunately not. Most of this line of thinking is the result of > looking at import functionality in different ways, including with > regards to the problem of modules getting imported twice (once as > __main__). I've been doing work on multi-file modules, custom module Watch out for that importing of the original script. Doing that has many risks, only one of which is the problem of the two names. In fact, any time you have mutual imports, you run a certain risk, if the modules involved have any code that's not inside defs. It's not well defined what order the initialisation happens, so you may wind up calling code in another module that's not really there yet. The module import tree should be strictly hierarchical, without cycles. if you need stuff from the __main__, pass it to the other module, don't let the other module peek back over your shoulder. In the case of a module importing things from your script, the solution is pretty simple. Move the needed code elsewhere, and import it both from your script and from the other module. DaveA
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: break in a module Ethan Furman <ethan@stoneleaf.us> - 2011-06-14 16:28 -0700
Re: break in a module Erik Max Francis <max@alcyone.com> - 2011-06-14 16:51 -0700
Re: break in a module Eric Snow <ericsnowcurrently@gmail.com> - 2011-06-14 18:51 -0600
Re: break in a module Ben Finney <ben+python@benfinney.id.au> - 2011-06-15 11:33 +1000
Re: break in a module Eric Snow <ericsnowcurrently@gmail.com> - 2011-06-14 20:21 -0600
Re: break in a module Erik Max Francis <max@alcyone.com> - 2011-06-16 15:09 -0700
Re: break in a module Dave Angel <davea@ieee.org> - 2011-06-15 00:02 -0400
Re: break in a module Erik Max Francis <max@alcyone.com> - 2011-06-16 15:07 -0700
Re: break in a module Chris Angelico <rosuav@gmail.com> - 2011-06-17 09:27 +1000
Re: break in a module Erik Max Francis <max@alcyone.com> - 2011-06-16 16:29 -0700
Re: break in a module Eric Snow <ericsnowcurrently@gmail.com> - 2011-06-16 18:00 -0600
Re: break in a module Chris Angelico <rosuav@gmail.com> - 2011-06-17 10:01 +1000
Re: break in a module Erik Max Francis <max@alcyone.com> - 2011-06-16 18:13 -0700
Re: break in a module Ethan Furman <ethan@stoneleaf.us> - 2011-06-16 19:17 -0700
Re: break in a module Erik Max Francis <max@alcyone.com> - 2011-06-16 21:21 -0700
Re: break in a module Ian Kelly <ian.g.kelly@gmail.com> - 2011-06-16 22:53 -0600
Re: break in a module Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-06-17 00:48 +0000
Re: break in a module Chris Angelico <rosuav@gmail.com> - 2011-06-17 10:57 +1000
Re: break in a module Erik Max Francis <max@alcyone.com> - 2011-06-16 18:21 -0700
Re: break in a module Ethan Furman <ethan@stoneleaf.us> - 2011-06-16 19:11 -0700
Re: break in a module Ian Kelly <ian.g.kelly@gmail.com> - 2011-06-16 19:58 -0600
Re: break in a module Erik Max Francis <max@alcyone.com> - 2011-06-16 21:24 -0700
Re: break in a module Ian Kelly <ian.g.kelly@gmail.com> - 2011-06-16 22:50 -0600
Re: break in a module Erik Max Francis <max@alcyone.com> - 2011-06-16 22:20 -0700
Re: break in a module Chris Angelico <rosuav@gmail.com> - 2011-06-17 15:56 +1000
Re: break in a module Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-06-17 06:00 +0000
Re: break in a module Erik Max Francis <max@alcyone.com> - 2011-06-17 00:09 -0700
Re: break in a module Cameron Simpson <cs@zip.com.au> - 2011-06-18 12:36 +1000
Re: break in a module Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-06-18 03:50 +0000
Re: break in a module Chris Angelico <rosuav@gmail.com> - 2011-06-18 14:31 +1000
Re: break in a module Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-06-18 04:49 +0000
Re: break in a module Chris Angelico <rosuav@gmail.com> - 2011-06-18 15:06 +1000
Re: break in a module Cameron Simpson <cs@zip.com.au> - 2011-06-21 20:04 +1000
Re: break in a module Eric Snow <ericsnowcurrently@gmail.com> - 2011-06-17 00:25 -0600
Re: break in a module Chris Angelico <rosuav@gmail.com> - 2011-06-15 11:33 +1000
csiph-web