Pyiterable API Documentation ============================ Python comes with some nice built-in methods for operating on iterables, but it can get messy really quickly if you want to transform an iterable multiple times. Write more expressive code by chaining built-in transformations with this module. Scroll down for examples. Classes ------- .. toctree:: classes/iterable Details ------- Inspired by: * `C#'s Enumerable class `_ * `Apache Spark RDD Operations `_ * `Java stream package `_ Instead of: .. code-block:: python values = ["1", "2", "5", "9"] to_int = map(lambda x: int(x), values) filtered = filter(lambda x: x > 4) sum = reduce(lambda a, b: a + b, to_int) or: .. code-block:: python values = ["1", "2", "5", "9"] sum = reduce( lambda a, b: a + b, filter( lambda x: x > 4, map(lambda x: int(x), values) ) ) do this: .. code-block:: python from pyiterable import Iterable ... values = Iterable(["1", "2", "5", "9"]) sum = (values .map(lambda x: int(x)) .filter(lambda x: x > 4) .reduce(lambda a, b: a + b) ) Release ------- 0.2.0 * Added ``first()``, which gives you the first value in ``Iterable``, with an optional default if no values exist * Added ``mapmany()``, which functions like map, except it expects more than one output for each item of ``Iterable`` 0.1.0 * First release! * *Iterable* class with equivalent built-in functions related to iterables Indices and tables ------------------ * :ref:`genindex` * :ref:`modindex` * :ref:`search`