Metadata-Version: 2.1 Name: more-itertools Version: 8.14.0 Summary: More routines for operating on iterables, beyond itertools Keywords: itertools,iterator,iteration,filter,peek,peekable,collate,chunk,chunked Author-email: Erik Rose Requires-Python: >=3.5 Description-Content-Type: text/x-rst Classifier: Development Status :: 5 - Production/Stable Classifier: Intended Audience :: Developers Classifier: Natural Language :: English Classifier: License :: OSI Approved :: MIT License Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3.6 Classifier: Programming Language :: Python :: 3.7 Classifier: Programming Language :: Python :: 3.8 Classifier: Programming Language :: Python :: 3.9 Classifier: Programming Language :: Python :: 3.10 Classifier: Programming Language :: Python :: 3 :: Only Classifier: Programming Language :: Python :: Implementation :: CPython Classifier: Programming Language :: Python :: Implementation :: PyPy Classifier: Topic :: Software Development :: Libraries Project-URL: Homepage, https://github.com/more-itertools/more-itertools ============== 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 `_, | | | `ichunked `_, | | | `chunked_even `_, | | | `sliced `_, | | | `distribute `_, | | | `divide `_, | | | `split_at `_, | | | `split_before `_, | | | `split_after `_, | | | `split_into `_, | | | `split_when `_, | | | `bucket `_, | | | `unzip `_, | | | `grouper `_, | | | `partition `_ | +------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Lookahead and lookback | `spy `_, | | | `peekable `_, | | | `seekable `_ | +------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Windowing | `windowed `_, | | | `substrings `_, | | | `substrings_indexes `_, | | | `stagger `_, | | | `windowed_complete `_, | | | `pairwise `_, | | | `triplewise `_, | | | `sliding_window `_ | | | `subslices `_, | +------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Augmenting | `count_cycle `_, | | | `intersperse `_, | | | `padded `_, | | | `repeat_each `_, | | | `mark_ends `_, | | | `repeat_last `_, | | | `adjacent `_, | | | `groupby_transform `_, | | | `pad_none `_, | | | `ncycles `_ | +------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Combining | `collapse `_, | | | `sort_together `_, | | | `interleave `_, | | | `interleave_longest `_, | | | `interleave_evenly `_, | | | `zip_offset `_, | | | `zip_equal `_, | | | `zip_broadcast `_, | | | `dotproduct `_, | | | `convolve `_, | | | `flatten `_, | | | `roundrobin `_, | | | `prepend `_, | | | `value_chain `_ | +------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Summarizing | `ilen `_, | | | `unique_to_each `_, | | | `sample `_, | | | `consecutive_groups `_, | | | `run_length `_, | | | `map_reduce `_, | | | `exactly_n `_, | | | `is_sorted `_, | | | `all_equal `_, | | | `all_unique `_, | | | `minmax `_, | | | `first_true `_, | | | `quantify `_ | | | `iequals `_ | +------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Selecting | `islice_extended `_, | | | `first `_, | | | `last `_, | | | `one `_, | | | `only `_, | | | `strictly_n `_, | | | `strip `_, | | | `lstrip `_, | | | `rstrip `_, | | | `filter_except `_, | | | `map_except `_, | | | `nth_or_last `_, | | | `unique_in_window `_, | | | `before_and_after `_, | | | `nth `_, | | | `take `_, | | | `tail `_, | | | `unique_everseen `_, | | | `unique_justseen `_, | | | `duplicates_everseen `_, | | | `duplicates_justseen `_ | | | `longest_common_prefix `_ | +------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Combinatorics | `distinct_permutations `_, | | | `distinct_combinations `_, | | | `circular_shifts `_, | | | `partitions `_, | | | `set_partitions `_, | | | `product_index `_, | | | `combination_index `_, | | | `permutation_index `_, | | | `powerset `_, | | | `random_product `_, | | | `random_permutation `_, | | | `random_combination `_, | | | `random_combination_with_replacement `_, | | | `nth_product `_, | | | `nth_permutation `_, | | | `nth_combination `_ | +------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Wrapping | `always_iterable `_, | | | `always_reversible `_, | | | `countable `_, | | | `consumer `_, | | | `with_iter `_, | | | `iter_except `_ | +------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Others | `locate `_, | | | `rlocate `_, | | | `replace `_, | | | `numeric_range `_, | | | `side_effect `_, | | | `iterate `_, | | | `difference `_, | | | `make_decorator `_, | | | `SequenceView `_, | | | `time_limited `_, | | | `map_if `_, | | | `consume `_, | | | `tabulate `_, | | | `repeatfunc `_ | +------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ Getting started =============== To get started, install the library with `pip `_: .. code-block:: shell pip install more-itertools The recipes from the `itertools docs `_ are included in the top-level package: .. code-block:: python >>> from more_itertools import flatten >>> iterable = [(0, 1), (2, 3)] >>> list(flatten(iterable)) [0, 1, 2, 3] Several new recipes are available as well: .. code-block:: python >>> 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``: * `Yo, I heard you like decorators `__ * `Tour of Python Itertools `__ (`Alternate `__) * `Real-World Python 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 `_.