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

Guido van Rossum guido@python.org
Sun, 14 Jul 2002 09:20:51 -0400


> > What about raising IndexError by default when someone attempts to call
> > .next() on an iterator already raising StopIteration?
> 
> +1
> 
> IndexError is probably better than inventing a new exception. The
> description of what actually happened would be in the exception
> text.

-1.  IndexError belongs to sequences.  I don't like the idea of
raising another exception at all -- we should either keep things the
way they are, or continue to raise StopIteration forever once it's
been raised.  Other suggestions don't make sense to me.

--Guido van Rossum (home page: http://www.python.org/~guido/)