[Python-ideas] Return expressions

Greg Ewing greg.ewing at canterbury.ac.nz
Thu Nov 20 22:28:32 CET 2014


Ron Adam wrote:

> It's my understanding looking ahead is problomatic for genrators because 
> they may have side effects when next() is called on them.

Not just generators, but any iterator.

Any algorithm that requires lookahead has problems if you
apply it more than once to the same iterator. Something has
to store the lookahead value in between times, and the
iterator protocol just doesn't allow for that.

-- 
Greg


More information about the Python-ideas mailing list