boltons/docs/iterutils.rst

74 lines
1.7 KiB
ReStructuredText
Raw Normal View History

``iterutils`` - ``itertools`` improvements
==========================================
2015-03-22 00:12:50 +00:00
.. automodule:: boltons.iterutils
.. _iteration:
Iteration
---------
These are generators and convenient :class:`list`-producing
counterparts comprising several common patterns of iteration not
present in the standard library.
.. autofunction:: split
.. autofunction:: split_iter
.. autofunction:: chunked
.. autofunction:: chunked_iter
.. autofunction:: pairwise
.. autofunction:: pairwise_iter
.. autofunction:: windowed
.. autofunction:: windowed_iter
.. autofunction:: unique
.. autofunction:: unique_iter
2015-09-21 09:40:33 +00:00
Nested
------
2015-09-24 10:36:22 +00:00
Nested data structures are common. Yet virtually all of Python's
compact iteration tools work with flat data: list comprehensions,
map/filter, generator expressions, itertools, even other
2015-09-24 18:51:21 +00:00
iterutils.
The functions below make working with nested iterables and other
containers as succinct and powerful as Python itself.
2015-09-21 09:40:33 +00:00
.. autofunction:: remap
Numeric
-------
Number sequences are an obvious target of Python iteration, such as
the built-in :func:`range`, :func:`xrange`, and
:func:`itertools.count`. Like the :ref:`iteration` members above,
these return iterators and lists, but take numeric inputs instead of
iterables.
.. autofunction:: backoff
.. autofunction:: backoff_iter
.. autofunction:: frange
.. autofunction:: xfrange
Categorization
--------------
These functions operate on iterables, dividing into groups based on a
given condition.
.. autofunction:: bucketize
.. autofunction:: partition
2015-07-30 08:58:47 +00:00
.. autofunction:: one
.. autofunction:: first
2015-07-30 08:58:47 +00:00
Type Checks
-----------
In the same vein as the feature-checking builtin, :func:`callable`.
.. autofunction:: is_iterable
.. autofunction:: is_scalar
2015-07-17 20:52:44 +00:00
.. autofunction:: is_collection