More routines for operating on iterables, beyond itertools
Project Links
Meta
Author: Erik Rose
Requires Python: >=3.9
Classifiers
Development Status
- 5 - Production/Stable
Intended Audience
- Developers
Natural Language
- English
License
- OSI Approved :: MIT License
Programming Language
- Python :: 3
- Python :: 3.9
- Python :: 3.10
- Python :: 3.11
- Python :: 3.12
- Python :: 3.13
- Python :: 3 :: Only
- Python :: Implementation :: CPython
- Python :: Implementation :: PyPy
Topic
- Software Development :: Libraries
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.
Apr 22, 2025
10.7.0
Jan 14, 2025
10.6.0
Sep 05, 2024
10.5.0
Aug 07, 2024
10.4.0
Jun 10, 2024
10.3.0
Jan 08, 2024
10.2.0
Aug 03, 2023
10.1.0
Jul 24, 2023
10.0.0
Feb 27, 2023
9.1.0
Oct 18, 2022
9.0.0
Aug 09, 2022
8.14.0
May 06, 2022
8.13.0
Nov 24, 2021
8.12.0
Nov 09, 2021
8.11.0
Sep 17, 2021
8.10.0
Sep 03, 2021
8.9.0
May 21, 2021
8.8.0
Feb 08, 2021
8.7.0
Oct 30, 2020
8.6.0
Aug 28, 2020
8.5.0
Jun 14, 2020
8.4.0
May 16, 2020
8.3.0
Jan 29, 2020
8.2.0
Jan 11, 2020
8.1.0
Dec 06, 2019
8.0.2
Dec 06, 2019
8.0.1
Nov 29, 2019
8.0.0
Jul 20, 2019
7.2.0
Jun 27, 2019
7.1.0
Mar 28, 2019
7.0.0
Feb 12, 2019
6.0.0
Dec 27, 2018
5.0.0
Jul 31, 2018
4.3.0
May 24, 2018
4.2.0
Jan 21, 2018
4.1.0
Dec 03, 2017
4.0.1
Dec 02, 2017
4.0.0
Jun 13, 2017
3.2.0
May 24, 2017
3.1.0
Apr 02, 2017
3.0.0
Mar 22, 2017
2.6.0
Jan 07, 2017
2.5.0
Dec 02, 2016
2.4.1
Dec 02, 2016
2.4
Nov 08, 2016
2.3
Mar 09, 2013
2.2
Sep 24, 2012
2.1
Jul 26, 2012
2.0
Jun 26, 2012
1.1
Apr 26, 2012
1.0
Wheel compatibility matrix
Files in release
No dependencies