Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: 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; 'context': 0.04; 'subject:module': 0.04; 'francis': 0.07; '>>>>': 0.09; 'erik': 0.09; 'established,': 0.09; "module's": 0.09; 'pm,': 0.10; 'this:': 0.10; 'def': 0.12; 'wrote:': 0.14; 'angelico': 0.16; 'looping': 0.16; 'restriction,': 0.16; 'structures,': 0.16; '16,': 0.16; 'traceback': 0.16; '(most': 0.16; 'cc:addr:python-list': 0.17; 'header:In-Reply-To:1': 0.21; "haven't": 0.22; 'thu,': 0.22; 'cc:2**0': 0.22; 'cc:no real name:2**0': 0.23; 'last):': 0.23; 'fri,': 0.23; "what's": 0.23; 'url:mailman': 0.26; 'message- id:@mail.gmail.com': 0.28; 'cc:addr:python.org': 0.30; 'url:listinfo': 0.30; 'fact': 0.30; 'received:209.85.215': 0.30; 'received:209.85.215.46': 0.30; 'received:mail- ew0-f46.google.com': 0.30; 'typeerror:': 0.30; "can't": 0.32; 'execution': 0.32; 'chris': 0.34; 'nobody': 0.34; '"",': 0.35; '17,': 0.35; 'none': 0.37; 'received:google.com': 0.37; 'received:209.85': 0.37; 'url:python': 0.38; 'could': 0.38; 'url:org': 0.38; 'but': 0.38; 'though': 0.38; 'returning': 0.38; 'subject:: ': 0.38; "i'd": 0.39; 'received:209': 0.39; 'almost': 0.60; 'simply': 0.60; 'believe': 0.66; '11:56': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=iOKT6E6AqxdQ1ufDfUyQjJMstfYOGqBOdZwHzXRh1/Q=; b=p4F/o3CF2b0Z34nfPlGxOJm77yI2egTs9nZhe7RGsb62OgmkejRUS0faLhgeKDyoRu V1h2SyzW1ax9MNmiWKzTErhgF96U1g/+dSsGbsvA58cpFRW0FeWz/F4Hc3AusgQdWMZr rIsZPvoZE5qK2DzyCfymmyC6UACWbj9z92sq0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=dSISpg/O8onaDgMbCf8wQm8qC7A3JjKkkssh5uqf3DMexEqAxWazSv9v3IEEXC6Zqn mQW+4D1PXWTLGN35pOvzBibW8WDyyaadHq4FXD2nRuFjMl0MTr0DPO+9z2CLdRWtvXlh DAXIE0fufK7Quq93E9zY5z8xVixiWNSkpONzw= MIME-Version: 1.0 In-Reply-To: References: <4DF7E75E.9000907@mrabarnett.plus.com> <6NWdnfBF0rgB42fQnZ2dnUVZ5h2dnZ2d@giganews.com> <4dfaa441$0$30002$c3e8da3$5496439d@news.astraweb.com> Date: Fri, 17 Jun 2011 00:25:43 -0600 Subject: Re: break in a module From: Eric Snow To: Chris Angelico Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 39 NNTP-Posting-Host: 82.94.164.166 X-Trace: 1308291944 news.xs4all.nl 49175 [::ffff:82.94.164.166]:41742 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:7805 On Thu, Jun 16, 2011 at 11:56 PM, Chris Angelico wrote: > On Fri, Jun 17, 2011 at 3:20 PM, Erik Max Francis wrote= : >> Yes, which could be rephrased as the fact that `break` and `continue` ar= e >> restricted to looping control structures, so reusing `break` in this con= text >> would be a bad idea. > > Which is why I believe 'return' would be a better choice, even though > returning a value other than None would make no sense. It would simply > be a restriction, and one that almost nobody would notice - like this: > I'd say let's not bikeshed on the name when the merits of "breaking" out of a module's execution haven't been established, but what's the point. -eric >>>> def f(): > =A0 =A0 =A0 =A0yield 1 > =A0 =A0 =A0 =A0yield 2 > =A0 =A0 =A0 =A0yield 3 > > >>>> a=3Df() >>>> a > >>>> a.send(1) > Traceback (most recent call last): > =A0File "", line 1, in > =A0 =A0a.send(1) > TypeError: can't send non-None value to a just-started generator > > ChrisA > -- > http://mail.python.org/mailman/listinfo/python-list >