[Python-Dev] Termination of two-arg iter()

Delaney, Timothy tdelaney@avaya.com
Tue, 16 Jul 2002 11:47:57 +1000


> From: Aahz [mailto:aahz@pythoncraft.com]
> 
> On Tue, Jul 16, 2002, Delaney, Timothy wrote:
> > From: Aahz [mailto:aahz@pythoncraft.com]
> >
> > I think the definition that some people are using is:
      ^^^^^
> > 
> > An exhausted iterator is one for which StopIteration has 
> > 
> > An empty iterator OTOH is one which will raise 
> 
> In order to draw this distinction, you have to change the 
> definition of
> "iterator" that we've been using.  The sole protocol of 
> iterator to date
> has been the existence of a next() method that either returns 
> an item or
> raises StopIteration.  Making statements about what an iterator *will*
> do counts as abuse IMO.  If you want a feature like that, go use
> something else -- don't break the simplicity of iterators.

Aahz - you did read the next paragraph didn't you.

"... I don't see a lot of point in distinguishing
between the two above cases."

I'm *against* distinguishing between the two - I do not want a feature like
that.

Tim Delaney