Reference: Iterators and generators¶
Quick-lookup pages. Short, dense, designed to skim. If you're here to learn the topic for the first time, start with Learn instead.
Pages in this section¶
itertoolscheatsheet — the wholeitertoolsmodule on one page:chain,groupby,islice,accumulate,takewhile,dropwhile,tee, and the combinatoric helpers.- Iterator protocol reference —
__iter__,__next__,StopIteration, and the distinction between an iterable and an iterator. - Generator syntax reference —
yield,yield from,.send(),.close(), and the generator-expression forms.