Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #8081
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <cameron@cskk.homeip.net> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.000 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'subject:module': 0.04; 'raised': 0.07; 'raises': 0.07; 'received:edu.au': 0.07; "shouldn't": 0.07; 'caller': 0.09; 'davis': 0.09; 'foo': 0.09; 'mix': 0.09; 'statement.': 0.09; 'throw': 0.09; 'this:': 0.10; 'wrote:': 0.14; '"finally"': 0.16; '"import"': 0.16; 'an:': 0.16; 'from:addr:cs': 0.16; 'from:addr:zip.com.au': 0.16; 'from:name:cameron simpson': 0.16; 'iterator': 0.16; 'message- id:@cskk.homeip.net': 0.16; 'received:202.125.174': 0.16; 'received:202.125.174.133': 0.16; 'received:boardofstudies.nsw.edu.au': 0.16; 'received:cskk.homeip.net': 0.16; 'received:harvey.boardofstudies.nsw.edu.au': 0.16; 'received:homeip.net': 0.16; 'received:nsw.edu.au': 0.16; 'touring': 0.16; 'traceback.': 0.16; 'word),': 0.16; 'cc:addr :python-list': 0.17; 'importing': 0.19; 'keyword': 0.19; 'cheers,': 0.19; 'header:In-Reply-To:1': 0.21; 'loop': 0.22; 'mechanism': 0.22; 'cc:2**0': 0.22; 'cc:no real name:2**0': 0.23; 'posted': 0.25; 'raise': 0.28; 'problem': 0.28; 'sat,': 0.29; 'import': 0.29; 'cc:addr:python.org': 0.30; 'module': 0.30; 'steven': 0.32; 'does': 0.33; 'lines': 0.33; '...': 0.34; 'thinking': 0.34; 'header:User-Agent:1': 0.35; "d'aprano": 0.35; 'module.': 0.35; 'else': 0.35; 'charset:us-ascii': 0.36; 'received:au': 0.37; 'another': 0.37; 'anything': 0.38; 'subject:: ': 0.38; 'user': 0.39; 'finished': 0.39; 'goes': 0.39; 'feature': 0.40; 'best': 0.60; 'received:202': 0.66; 'special': 0.66; 'care': 0.72; 'cameron': 0.73; 'article': 0.76; 'riding': 0.84; 'travel,': 0.84 |
| Date | Tue, 21 Jun 2011 20:04:43 +1000 |
| From | Cameron Simpson <cs@zip.com.au> |
| To | Steven D'Aprano <steve+comp.lang.python@pearwood.info> |
| Subject | Re: break in a module |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset=us-ascii |
| Content-Disposition | inline |
| In-Reply-To | <4dfc2084$0$30002$c3e8da3$5496439d@news.astraweb.com> |
| User-Agent | Mutt/1.5.20 (2009-06-14) |
| References | <4dfc2084$0$30002$c3e8da3$5496439d@news.astraweb.com> |
| 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.221.1308650694.1164.python-list@python.org> (permalink) |
| Lines | 50 |
| NNTP-Posting-Host | 82.94.164.166 |
| X-Trace | 1308650695 news.xs4all.nl 49044 [::ffff:82.94.164.166]:44954 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:8081 |
Show key headers only | View raw
On 18Jun2011 03:50, Steven D'Aprano <steve+comp.lang.python@pearwood.info> wrote:
| On Sat, 18 Jun 2011 12:36:42 +1000, Cameron Simpson wrote:
| > Just to throw another approach into the mix (because I was thinking
| > about the "finally" word), what about:
| >
| > raise StopImport
| >
| > along the lines of generators' "raise StopIteration".
| >
| > Then the import machinery can catch it, no new keyword is needed and no
| > existing keyword needs feature creeping.
|
| The only problem is that the importing module needs to catch it, or else
| you get a traceback. The importer shouldn't need to care what goes in
| inside the module.
I was thinking the import mechanism itself would catch it, not the user
of the "import" statement. Just as this:
for i in iterator:
...
quietly ceases the loop when the iterator raises StopIteration, the
importer would consider a module that raised StopImport during the import
to have finished its import successfully.
So the caller does an:
import foo
as normal, with no special wrapping. And the module goes:
spam()
if condition:
raise StopIteration
ham()
cheese()
Cheers,
--
Cameron Simpson <cs@zip.com.au> DoD#743
http://www.cskk.ezoshosting.com/cs/
In article <323C4DB9.6A76@ss1.csd.sc.edu>, lhartley@ss1.csd.sc.edu wrote:
| It still is true that the best touring bike is the one that you are
| riding right now. Anything can be used for touring. As long as you
| can travel, you are touring.
I beleive such true and profound statements are NOT allowed to be posted
in this newsgroup, and are also against the charter. You've been warned.
- Randy Davis DoD #0013 <randy@agames.com> in rec.moto
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