Last Updated: May 22, 2026
The itertools module is Python's pre-built kit of lazy iterator operators. The functions read like a vocabulary of stream operations: chain a few sources together, filter on a predicate, take the first ten, group consecutive duplicates, enumerate every product variant. Most of them are tiny on their own, but they compose into pipelines that would otherwise need bespoke generator functions. This lesson walks through every commonly-used tool, grouped by what it does, with one e-commerce example and a "use when" note for each.