Nov. 20, 2014
9:28 p.m.
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