[Python-ideas] Propagating StopIteration value

Greg Ewing greg.ewing at canterbury.ac.nz
Tue Oct 9 09:51:20 CEST 2012

Oscar Benjamin wrote:

> They do provide the same kind of iterator in the sense that they
> reproduce the properties of the object *in so far as it is an
> iterator* by yielding the same values.

I think we agree on that. Where we seem to disagree is on
whether returning a value with StopIteration is part of the
iterator protocol or the generator protocol.

To my mind it's part of the generator protocol, and as such,
itertools functions are not under any obligation to support


More information about the Python-ideas mailing list