more-itertools
More routines for operating on iterables, beyond itertools
Description
============== More Itertools ============== .. image:: https://readthedocs.org/projects/more-itertools/badge/?version=latest :target: https://more-itertools.readthedocs.io/en/stable/ 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. +------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Grouping | `chunked <https://more-itertools.readthedocs.io/en/stable/api.html#more_itertools.chunked>`_, | | | `ichunked <https://more-itertools.readthedocs.io/en/stable/api.html#more_itertools.ichunked>`_, | | | `chunked_even <https://more-itertools.readthedocs.io/en/stable/api.html#more_itertools.chunked_even>`_, | | | `sliced <https://more-itertools.readthedocs.io/en/stable/api.html#more_itertools.sliced>`_, | | | `constrained_batches <https://more-itertools.readthedocs.io/en/stable/api.html#more_itertools.constrained_batches>`_, | | | `distribute <https://more-itertools.readthedocs.io/en/stable/api.html#more_itertools.distribute>`_, | | | `divide <https://more-itertools.readthedocs.io/en/stable/api.html#more_itertools.divide>`_, | | | `split_at <https://more-itertools.readthedocs.io/en/stable/api.html#more_itertools.split_at>`_, | | | `split_before <https://more-itertools.readthedocs.io/en/stable/api.html#more_itertools.split_before>`_, | | | `split_after <https://more-itertools.readthedocs.io/en/stable/api.html#more_itertools.split_after>`_, | | | `split_into <https://more-itertools.readthedocs.io/en/stable/api.html#more_itertools.split_into>`_, | | | `split_when <https://more-itertools.readthedocs.io/en/stable/api.html#more_itertools.split_when>`_, | | | `bucket <https://more-itertools.readthedocs.io/en/stable/api.html#more_itertools.bucket>`_, | | | `unzip <https://more-itertools.readthedocs.io/en/stable/api.html#more_itertools.unzip>`_, | | | `batched <https://more-itertools.readthedocs.io/en/stable/api.html#more_itertools.batched>`_, | | | `grouper <https://more-itertools.readthedocs.io/en/stable/api.html#more_itertools.grouper>`_, | | | `partition <https://more-itertools.readthedocs.io/en/stable/api.html#more_itertools.partition>`_ | +------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Lookahead and lookback | `spy <https://more-itertools.readthedocs.io/en/stable/api.html#more_itertools.spy>`_, | | | `peekable <https://more-itertools.readthedocs.io/en/stable/api.html#more_itertools.peekable>`_, | | | `seekable <https://more-itertools.readthedocs.io/en/stable/api.html#more_itertools.seekable>`_ | +------------------------+---------------------------------------------------------------------------------------------------------------
Release History
| Version | Changes | Urgency | Date |
|---|---|---|---|
| 11.0.2 | Imported from PyPI (11.0.2) | Low | 4/21/2026 |
| v11.0.2 | * The changes to the type hints for `always_iterable` in 11.0.0 have been reverted due to reported problems (thanks to ngoldbaum and rhettinger) * `zip_equal` was removed in 11.0.0. It had been deprecated and raising ``DeprecationWarning`` since 2021, but it's removal shoul have been documented in 11.0.0's release notes. We regret the error. * `running_statistics` has been moved from ``more_itertools.more`` to ``more_itertools.recipes``. Its docstring was also improved (thanks to mastash3ff an | Medium | 4/9/2026 |
| v11.0.1 | This release restores `pairwise`, which was mistakenly removed in 11.0.0 instead of being deprecated. It is now marked as deprecated and will be removed in a future major release. Use `itertools.pairwise` as a replacement. | Medium | 4/2/2026 |
| v11.0.0 | ### Potentially breaking changes * Python 3.9 support was dropped, since it went EOL on 2025-10-31 * `callback_iter` is deprecated. It will be removed in a future major release. * `iequals` no longer returns ``True`` when called with ``([], [ANY])`` (thanks to rhettinger and pochmann3) * The ``pred`` argument for `locate` and `replace` must now be able to handle a variable number of arguments. See their docstrings for details. (thanks to veeceey, james-wasson, and pochmann3) * `unique_ | Medium | 4/2/2026 |
| v10.8.0 | ## What's Changed * Fix typo in version history for 10.7.0 by bbayles in https://github.com/more-itertools/more-itertools/pull/981 * Issue 980: Fix variable names: iterable vs iterator by rhettinger in https://github.com/more-itertools/more-itertools/pull/982 * Improve docstrings for dft, idft, and multinomial by rhettinger in https://github.com/more-itertools/more-itertools/pull/983 * Add a note about polynomial endianness by bbayles in https://github.com/more-itertools/more-itertools/pull/ | Low | 9/2/2025 |
| v10.7.0 | See the change log [here](https://github.com/more-itertools/more-itertools/blob/28ab73678adc39eacc2610bd67c1c4a37def6c28/docs/versions.rst#L8) for details. | Low | 4/22/2025 |
| v10.6.0 | * New functions: * `is_prime` and `nth_prime` were added (thanks to JamesParrott and rhettinger) * `loops` was added (thanks to rhettinger) * Changes to existing functions: * `factor` was optimized to handle larger inputs and use less memory (thanks to rhettinger) * `spy` was optimized to enable nested calls (thanks to rhettinger) * `polynomial_from_roots` was made non-recursive and able to handle larger numbers of roots (thanks to pochmann3 and rhettinger) * `is | Low | 1/14/2025 |
| v10.5.0 | ## What's Changed * Optimize all_equal recipe by @bbayles in https://github.com/more-itertools/more-itertools/pull/899 * Reduce groupby.__next__ calls in all_equal by @bbayles in https://github.com/more-itertools/more-itertools/pull/903 * Fix types.UnionType by @bbayles in https://github.com/more-itertools/more-itertools/pull/905 * Version 10.5.0 by @bbayles in https://github.com/more-itertools/more-itertools/pull/906 **Full Changelog**: https://github.com/more-itertools/more-itertools/ | Low | 9/6/2024 |
| v10.4.0 | ## What's Changed * Issue 854: sample improvements by @bbayles in https://github.com/more-itertools/more-itertools/pull/855 * Issue 858: Use chain and starmap in run_length.decode by @bbayles in https://github.com/more-itertools/more-itertools/pull/861 * Issue 859: Update totient recipe by @bbayles in https://github.com/more-itertools/more-itertools/pull/860 * Distinct permutations of incomparable items by @JamesParrott in https://github.com/more-itertools/more-itertools/pull/834 * Clarify | Low | 8/7/2024 |
| v10.3.0 | ## What's Changed * 100% Code Coverage by @haukex in https://github.com/more-itertools/more-itertools/pull/792 * Remove recursion from `collapse` by @james-wasson in https://github.com/more-itertools/more-itertools/pull/796 * Closes #780: add pre/postpend examples in value_chain doc by @bjrtx in https://github.com/more-itertools/more-itertools/pull/802 * Increase performance of `padded` by @james-wasson in https://github.com/more-itertools/more-itertools/pull/805 * Update table of contents | Low | 6/10/2024 |
| v10.2.0 | * New functions * `iter_suppress` (thanks to jaraco, pochmann, and rhettinger) * `filter_map` (thanks to struktured) * `classify_unique` (thanks to haukex) * `totient` (from the itertools docs) * `reshape` (from the itertools docs) * Changes to existing functions * `factor`, `iter_index`, `sieve`, and `unique_justseen` were updated to match the itertools docs * `first` was was optimized (thanks to pochmann) * `takewhile_inclusive` was was refactored (th | Low | 1/8/2024 |
| v10.1.0 | ## What's Changed * Add more tests for `zip_broadcast()` by @kalekundert in https://github.com/more-itertools/more-itertools/pull/739 * Added takewhile_inclusive by @OlegAlexander in https://github.com/more-itertools/more-itertools/pull/736 * Speed up `zip_broadcast()` by pre-filling the scalar elements by @kalekundert in https://github.com/more-itertools/more-itertools/pull/740 * Added outer_product. by @OlegAlexander in https://github.com/more-itertools/more-itertools/pull/743 * Simplify | Low | 8/4/2023 |
| v10.0.1 | This is a docs-only release. There are no changes to the code in the package, and no changes distributed to PyPI. See PR #738 for details. | Low | 7/24/2023 |
| v10.0.0 | ## What's Changed * Update recipes.iter_index to match CPython PR 102360 by @bbayles in https://github.com/more-itertools/more-itertools/pull/690 * fixup - add missing commas to the readme function table by @lonnen in https://github.com/more-itertools/more-itertools/pull/692 * fixup remove 3.6 from tox by @lonnen in https://github.com/more-itertools/more-itertools/pull/693 * seekable: Add relative_seek by @karlb in https://github.com/more-itertools/more-itertools/pull/694 * Optimize _chunke | Low | 7/24/2023 |
| v9.1.1 | This is a docs-only release to fix issue #688. There is no corresponding PyPI release. | Low | 3/2/2023 |
| v9.1.0 | See PR #678 for details. | Low | 2/27/2023 |
| v9.0.0 | See PR #647 for details | Low | 10/18/2022 |
| v8.14.0 | See PR #634 | Low | 10/9/2022 |
| v8.13.0 | See PR #608 | Low | 5/6/2022 |
| v8.12.0 | Shipped to fix #578 | Low | 11/24/2021 |
| v8.11.2 | This is another docs-only release. It fixes an issue with ReadTheDocs, and doesn't contain any code changes. There is no corresponding version on PyPI. | Low | 11/19/2021 |
| v8.11.1 | This is a docs-only release incorporating PR #577. It fixes an issue with ReadTheDocs, and doesn't contain any code changes. There is no corresponding version on PyPI. | Low | 11/9/2021 |
| v8.11.0 | See the [release notes](https://github.com/more-itertools/more-itertools/blob/c210e7e94a446eaedccbf1a67f5a9e54582ee27d/docs/versions.rst). | Low | 11/9/2021 |
| v8.10.0 | See PR #555 for details. | Low | 9/17/2021 |
| v8.9.0 | See PR #547 for details. | Low | 9/3/2021 |
| v8.8.0 | See PR #520 for details | Low | 5/21/2021 |
| v8.7.0 | See the [release notes](https://github.com/more-itertools/more-itertools/blob/481082d0577d4a6e348440270cf14658299e9390/docs/versions.rst) for details. | Low | 2/8/2021 |
| v8.6.0 | See the [changelog](https://github.com/more-itertools/more-itertools/blob/4d2e1db8eced66fa797832b2b2d720b4f6ae6483/docs/versions.rst#860) for details. | Low | 10/30/2020 |
| 8.5.0 | See the [release notes](https://github.com/more-itertools/more-itertools/blob/b0b56acc0669ba77f64a93602355aed50532566a/docs/versions.rst). | Low | 8/28/2020 |
| v8.4.0 | See [the changelog](https://github.com/more-itertools/more-itertools/blob/fc70d910cd2a8579e9b4e5fd38f8a8acf4abb2d7/docs/versions.rst#840) for details. | Low | 6/14/2020 |
| v8.3.0 | See the [release notes](https://github.com/more-itertools/more-itertools/blob/41a6d0fcc01b29e6c5839979a16a834a7b4d0fd8/docs/versions.rst#830) for details. | Low | 5/16/2020 |
| v8.2.0 | See the [release notes](https://raw.githubusercontent.com/erikrose/more-itertools/0861bed72ddd4c8ebcfa3a932b7689e272c43478/docs/versions.rst) for details. | Low | 1/29/2020 |
| v8.1.0 | See the [release notes](https://github.com/erikrose/more-itertools/blob/ba499fc5f38c7441271c3f147cfd9abbc587556d/docs/versions.rst). | Low | 1/11/2020 |
| v8.0.2 | See [the release notes](https://github.com/erikrose/more-itertools/blob/b2c747c2bf642bb9e193a3428bb0052614d420b4/docs/versions.rst#802). | Low | 12/6/2019 |
| v8.0.1 | See the [release notes](https://github.com/erikrose/more-itertools/blob/765c71b265bb6b34f28fc14500f0f4ab2d3d36ef/docs/versions.rst#801) for details. | Low | 12/6/2019 |
| v8.0.0 | See [the release notes](https://github.com/erikrose/more-itertools/blob/4661c942c49fe891a80b50c201983d00db75af13/docs/versions.rst#800) for details. | Low | 11/29/2019 |
| v7.2.0 | See the [release notes](https://github.com/erikrose/more-itertools/blob/0f4a66cdce0e153594eb95beb292fd5ea4393473/docs/versions.rst) for details. | Low | 7/20/2019 |
| v7.1.0 | See [the release notes](https://github.com/erikrose/more-itertools/blob/4152860cbbd7a073253d075472c1eb3b73e38a6a/docs/versions.rst#710) for details. | Low | 6/27/2019 |
| 7.0.0 | See [the release notes](https://github.com/erikrose/more-itertools/blob/7fcf148de6482484298796553fccbf9ccfd31516/docs/versions.rst) for the full list of changes. | Low | 3/28/2019 |
| 6.0.0 | This is the first Python 3-only release. Python 2 users may use [version 5.0.0](https://github.com/erikrose/more-itertools/releases/tag/5.0.0). See [the release notes](https://github.com/erikrose/more-itertools/blob/e36eeebc9d01d2dbbe232880741e88585a95bf7d/docs/versions.rst#600) for the full list of changes. | Low | 2/12/2019 |
| 5.0.0 | See PR #252 for notes. | Low | 12/27/2018 |
| 4.3.1 | This is [version 4.3.0](https://github.com/erikrose/more-itertools/releases/tag/4.3.0) plus PR #226 . There is no corresponding PyPI release; this is just to fix the docs on RTD. | Low | 8/1/2018 |
| 4.3.0 | Release 4.3.0 | Low | 7/31/2018 |
| 4.2.0 | See PR #211 for notes. | Low | 5/24/2018 |
| 4.1.0 | See PR #194 for notes. | Low | 1/21/2018 |
| 4.0.1 | See PR #180. Download from [PyPI](https://pypi.python.org/pypi/more-itertools/4.0.1). | Low | 12/3/2017 |
| 4.0.0 | See PR #175. Download from [PyPI](https://pypi.python.org/pypi/more-itertools/4.0.0). | Low | 12/3/2017 |
| 3.2.0 | See PR #150. Download from [PyPI](https://pypi.python.org/pypi/more-itertools/3.20). | Low | 12/3/2017 |
| 3.1.0 | See PR #141. Download from [PyPI](https://pypi.python.org/pypi/more-itertools/3.1.0). | Low | 5/24/2017 |
| 3.0.0 | See PR #123. Download from [PyPI](https://pypi.python.org/pypi/more-itertools/3.0.0). | Low | 4/2/2017 |
| 2.6.0 | See PR #119. Download from [PyPI](https://pypi.python.org/pypi/more-itertools/2.6.0). | Low | 3/22/2017 |
