Python’s itertools library is a gem - you can compose elegant solutions for a variety of problems with the functions it provides. In more-itertools we collect additional building blocks, recipes, and routines for working with Python iterables.
Getting started
To get started, install the library with pip:
pip install more-itertools
The recipes from the itertools docs are included in the top-level package:
>>> from more_itertools import flatten
>>> iterable = [(0, 1), (2, 3)]
>>> list(flatten(iterable))
[0, 1, 2, 3]
Several new recipes are available as well:
>>> from more_itertools import chunked
>>> iterable = [0, 1, 2, 3, 4, 5, 6, 7, 8]
>>> list(chunked(iterable, 3))
[[0, 1, 2], [3, 4, 5], [6, 7, 8]]
>>> from more_itertools import spy
>>> iterable = (x * x for x in range(1, 6))
>>> head, iterable = spy(iterable, n=3)
>>> list(head)
[1, 4, 9]
>>> list(iterable)
[1, 4, 9, 16, 25]
For the full listing of functions, see the API documentation.
Links elsewhere
Blog posts about more-itertools:
Development
more-itertools is maintained by @erikrose and @bbayles, with help from many others. If you have a problem or suggestion, please file a bug or pull request in this repository. Thanks for contributing!
Version History
The version history can be found in documentation.
Release files for more-itertools 11.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| more_itertools-11.1.0.tar.gz | 145.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| more_itertools-11.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 218.0 kB
Release files / more_itertools-11.1.0.tar.gz
| Download URL | more_itertools-11.1.0.tar.gz |
|---|---|
| Size | 145.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
48e8f4d9e7e5878571ecf6f2b4e57634f93cd474cc8cfbd2376f2d11b396e30d
|
|
BLAKE2b-256 checksum How to use checksums |
de1df4da6f02cdffe04d6362210b807146a26044c88d839208aec273bb0d9184
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.3
|
Release files / more_itertools-11.1.0-py3-none-any.whl
| Download URL | more_itertools-11.1.0-py3-none-any.whl |
|---|---|
| Size | 72.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4b65538ae22f6fed0ce4874efd317463a7489796a0939fa66824dd542125a192
|
|
BLAKE2b-256 checksum How to use checksums |
e83d1087453384dbde46a8c7f9356eead2c58be8a7bf156bca40243377c85715
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.3
|