Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #9658

Re: Possible File iteration bug

Date 2011-07-17 09:28 +1000
From Cameron Simpson <cs@zip.com.au>
Subject Re: Possible File iteration bug
References <4e2108b0$0$29972$c3e8da3$5496439d@news.astraweb.com>
Newsgroups comp.lang.python
Message-ID <mailman.1139.1310858923.1164.python-list@python.org> (permalink)

Show all headers | View raw


On 16Jul2011 13:42, Steven D'Aprano <steve+comp.lang.python@pearwood.info> 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 <cs@zip.com.au> 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

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Possible File iteration bug Billy Mays <noway@nohow.com> - 2011-07-14 15:46 -0400
  Re: Possible File iteration bug Ian Kelly <ian.g.kelly@gmail.com> - 2011-07-14 14:00 -0600
    Re: Possible File iteration bug Billy Mays <noway@nohow.com> - 2011-07-14 16:15 -0400
      Re: Possible File iteration bug Hrvoje Niksic <hniksic@xemacs.org> - 2011-07-14 22:39 +0200
  Re: Possible File iteration bug Terry Reedy <tjreedy@udel.edu> - 2011-07-14 16:43 -0400
  Re: Possible File iteration bug "bruno.desthuilliers@gmail.com" <bruno.desthuilliers@gmail.com> - 2011-07-15 01:01 -0700
    Re: Possible File iteration bug Billy Mays <noway@nohow.com> - 2011-07-15 08:26 -0400
      Re: Possible File iteration bug Thomas Rachel <nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de> - 2011-07-15 16:21 +0200
      Re: Possible File iteration bug Terry Reedy <tjreedy@udel.edu> - 2011-07-15 17:45 -0400
      Re: Possible File iteration bug Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-07-16 13:42 +1000
        Re: Possible File iteration bug Chris Angelico <rosuav@gmail.com> - 2011-07-16 14:07 +1000
        Re: Possible File iteration bug Cameron Simpson <cs@zip.com.au> - 2011-07-17 09:28 +1000
        Re: Possible File iteration bug Thomas Rachel <nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de> - 2011-07-17 09:26 +0200
  Re: Possible File iteration bug Thomas Rachel <nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de> - 2011-07-15 14:39 +0200
    Re: Possible File iteration bug Billy Mays <noway@nohow.com> - 2011-07-15 08:52 -0400
      Re: Possible File iteration bug Chris Angelico <rosuav@gmail.com> - 2011-07-15 22:58 +1000
      Re: Possible File iteration bug Thomas Rachel <nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de> - 2011-07-15 16:28 +0200
        Re: Possible File iteration bug Billy Mays <81282ed9a88799d21e77957df2d84bd6514d9af6@myhashismyemail.com> - 2011-07-15 10:42 -0400
          Re: Possible File iteration bug Thomas Rachel <nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de> - 2011-07-15 22:46 +0200
          Re: Possible File iteration bug Ethan Furman <ethan@stoneleaf.us> - 2011-07-15 14:20 -0700
          Re: Possible File iteration bug Terry Reedy <tjreedy@udel.edu> - 2011-07-15 17:47 -0400

csiph-web