Popular recipes tagged "iter"http://code.activestate.com/recipes/tags/iter/2010-08-17T13:41:41-07:00ActiveState Code Recipespeek ahead an iterator (Python)
2010-08-17T13:41:41-07:00Quintijn Hoogenboomhttp://code.activestate.com/recipes/users/4171692/http://code.activestate.com/recipes/577361-peek-ahead-an-iterator/
<p style="color: grey">
Python
recipe 577361
by <a href="/recipes/users/4171692/">Quintijn Hoogenboom</a>
(<a href="/recipes/tags/iter/">iter</a>, <a href="/recipes/tags/iterator/">iterator</a>, <a href="/recipes/tags/peek/">peek</a>, <a href="/recipes/tags/peeking/">peeking</a>).
</p>
<p>a merge of recipes 16.7 and 19.18 of the python cookbook (2nd edition).</p>
<p>you can peek ahead more steps if needed, or just use the preview variable for the next item of the list.</p>