itertools

The standard library module of looping tools, such as islice, chain, product, combinations and groupby, that work lazily on any iterable.

In more detail

islice(iterable, n) takes the first n items of any iterator, even an endless one; combinations(items, 2) gives every pair. They save writing nested loops by hand.

Related terms

Taught in

References