Neil Cerutti wrote:

> For use in a hand-coded parser I wrote the following simple
> iterator with look-ahead. I haven't thought too deeply about what
> peek ought to return when the iterator is exhausted. Suggestions
> are respectfully requested. As it is, you can't be sure what a
> peek() => None signifies until the next iteration unless you
> don't expect None in your sequence.

There is a different implementation in the Cookbook already:
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/304373

George

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to