Path: csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!news.glorb.com!news.astraweb.com!border6.newsrouter.astraweb.com!not-for-mail From: Ben Finney Newsgroups: comp.lang.python Subject: Re: break in a module References: <4DF7E75E.9000907@mrabarnett.plus.com> X-Public-Key-ID: 0xAC128405 X-Public-Key-Fingerprint: 517C F14B B2F3 98B0 CB35 4855 B8B2 4C06 AC12 8405 X-Public-Key-URL: http://www.benfinney.id.au/contact/bfinney-pubkey.asc X-Post-From: Ben Finney Date: Wed, 15 Jun 2011 11:33:22 +1000 Message-ID: <87k4cnswt9.fsf@benfinney.id.au> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux) Cancel-Lock: sha1:fR2HSEF1Px7xV9xdlnwDyHm1ksc= MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Lines: 29 Organization: Unlimited download news at news.astraweb.com NNTP-Posting-Host: d641bbd8.news.astraweb.com X-Trace: DXC=\:S[cQFcP=^7HkD[4f_4]SL?0kYOcDh@ZN7:H2`MmAUS3bEJ6cEhU?X]G;2>V^?kWSbEW9A[5UK?UNZ[SL`C\KgSleV]PhQM0>W Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:7661 Eric Snow writes: > I apologize if my example was unclear. I kept it pretty simple. That's a good goal, but unfortunately in this case it means the purpose is opaque. > In general it would be nice to do some checks up front and decide > whether or not to continue executing the module, rather than waiting > until the end to decide: > > if condition_1: > ... > return > if condition_2: > ... > return > > # now do my expensive module stuff I have never seen code that needs this, and can't imagine why the above would be a good design for a module. Is there real code online somewhere that we can see which serves as a real example for your use case? -- \ “There is no reason anyone would want a computer in their | `\ home.” —Ken Olson, president, chairman and founder of Digital | _o__) Equipment Corp., 1977 | Ben Finney