September 2026
1051 pages
35h 4m
English
At this point, we’ll introduce the itertools module of the standard library, which contains generator functions that are often useful in everyday programming. For example, itertools allows you to iterate over all combinations or permutations of elements in a given list.
Table 21.2 lists the generators contained in the itertools module and explains them briefly. Detailed descriptions follow in the subsequent sections.
|
Function |
Description |
|---|---|
|
accumulate(iterable, [func]) |
Iterates the partial sums of the elements of iterable |
|
batched(iterable, n, {strict}) |
Iterates through the elements of iterable in batches of n elements each |
|
chain([*iterables]) |
Iterates the concatenation of the passed ... |
Read now
Unlock full access