Path: csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!zen.net.uk!dedekind.zen.co.uk!tudelft.nl!txtfeed1.tudelft.nl!multikabel.net!newsfeed10.multikabel.net!feeder2.cambriumusenet.nl!feed.tweaknews.nl!194.109.133.85.MISMATCH!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; 'subject:bug': 0.04; 'test,': 0.04; 'exception,': 0.07; 'received:edu.au': 0.07; 'python': 0.08; 'caller': 0.09; 'seriously.': 0.09; 'exception': 0.12; 'wrote:': 0.15; 'billy': 0.16; 'entirely.': 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; 'okay,': 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; 'protocol': 0.16; 'cc:addr:python-list': 0.16; 'suggest': 0.17; 'issue.': 0.19; 'cc:2**0': 0.21; 'cc:no real name:2**0': 0.22; 'header:In-Reply-To:1': 0.22; 'raise': 0.28; 'problem': 0.29; 'cc:addr:python.org': 0.30; 'carrying': 0.30; 'header:User- Agent:1': 0.34; 'there': 0.34; 'sometimes,': 0.35; 'charset:us- ascii': 0.36; 'received:au': 0.36; 'convenient': 0.37; 'but': 0.37; 'could': 0.37; 'subject:: ': 0.38; 'signal': 0.38; 'steven': 0.38; 'data': 0.39; 'might': 0.39; "we've": 0.62; 'back': 0.63; 'received:202': 0.66; 'cameron': 0.67; 'introduce': 0.79; 'steering': 0.84; 'subject:Possible': 0.84 Date: Sun, 17 Jul 2011 09:28:40 +1000 From: Cameron Simpson To: Steven D'Aprano Subject: Re: Possible File iteration bug MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4e2108b0$0$29972$c3e8da3$5496439d@news.astraweb.com> User-Agent: Mutt/1.5.21 (2010-09-15) References: <4e2108b0$0$29972$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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 25 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1310858923 news.xs4all.nl 23941 [2001:888:2000:d::a6]:32801 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:9658 On 16Jul2011 13:42, Steven D'Aprano wrote: | Billy Mays wrote: | > I was thinking that a convenient solution to this problem would be to | > introduce a new Exception call PauseIteration, which would signal to the | > caller that there is no more data for now, but not to close down the | > generator entirely. | | It never fails to amuse me how often people consider it "convenient" to add | new built-in functionality to Python to solve every little issue. As | pie-in-the-sky wishful-thinking, it can be fun, but people often mean it to | be taken seriously. | | Okay, we've come up with the solution of a new exception, PauseIteration, | that the iterator protocol will recognise. One might suggest that Billy could wrp his generator in a Queue(1) and use the .empty() test, and/or raise his own PauseIteration from the wrapper. -- Cameron Simpson DoD#743 http://www.cskk.ezoshosting.com/cs/ No team manager will tell you this; but they all want to see you come walking back into the pits sometimes, carrying the steering wheel. - Mario Andretti