More Itertools
A Python package offering additional routines for working with iterables, extending beyond the standard itertools module. Current version: 10.8.0. Maintained with regular updates to enhance functionality and performance.
Warnings
- breaking Python 3.7 support dropped in version 10.0.0 due to its end of life on 2023-06-27.
- breaking The 'first_true()' function now returns 'None' by default, changing its previous behavior.
- deprecated The 'batched()' function is now an alias for 'itertools.batched' in Python 3.12 and later.
- gotcha The 'chunked()' and 'sliced()' functions now accept a 'strict' parameter, affecting their behavior.
Install
-
pip install more-itertools
Imports
- chunked
from more_itertools import chunked
- windowed
from more_itertools import windowed
Quickstart
from more_itertools import chunked iterable = [0, 1, 2, 3, 4, 5, 6, 7, 8] result = list(chunked(iterable, 3)) print(result) # Output: # [[0, 1, 2], [3, 4, 5], [6, 7, 8]]