Iterator class for functional programming
f_it: Functional Iterator
Iterator class for functional programming in python
- Free software: MIT license
- Documentation: https://f_it.readthedocs.io.
- A single wrapper class exposing chain-able methods for lazily transforming iterators
- Wraps functions from functools, itertools, and some extras
- Optionally has a length, which is calculated for subsequent operations if possible
Note that this package is for convenience/ interface comfort purposes and does not provide the guarantees of a true functional language.
pip install f_it
from f_it import FIt it = FIt(range(10)) transformed = it.map( # cube elements lambda x: x**3 ).filter( # drop even elements lambda x: x % 2 ).cycle( # repeat the whole iterator 3 times 3 ).islice( # take some elements from the middle 5, 10 ).chain( # add 0-4 to the end range(5) ).chunk( # separate into 2-length chunks 2 ) # nothing has been evaluated yet! # evaluate operations, reading into a list # if tqdm is available, show progress bar as_list = transformed.progress().apply(list)
- First release on PyPI.
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size||File type||Python version||Upload date||Hashes|
|Filename, size f_it-0.1.1-py2.py3-none-any.whl (7.9 kB)||File type Wheel||Python version py2.py3||Upload date||Hashes View|
|Filename, size f_it-0.1.1.tar.gz (16.8 kB)||File type Source||Python version None||Upload date||Hashes View|