A simple data-flow framework based on iterator chaining
nuts-flow is largely a thin wrapper around Pythonâ€™s itertools that allows the chaining of iterators using the >> operator. This leads to more readable code that highlights the flow of data. The following example shows two implementations of a simple data processing pipeline; the first based on itertools and the second using nuts-flow:
>>> from itertools import islice, ifilter >>> list(islice(ifilter(lambda x: x > 5, xrange(10)), 3)) [6, 7, 8]>>> from nutsflow import Range, Filter, Take, Collect, _ >>> Range(10) >> Filter(_ > 5) >> Take(3) >> Collect() [6, 7, 8]
Both examples extract the first three numbers within range [0, 9] that are greater than five. However, the nuts-flow pipeline is easier to understand than the nested itertools code.
Release history Release notifications | RSS feed
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 nutsflow-1.0.35-py2.py3-none-any.whl (45.4 kB)||File type Wheel||Python version py2.py3||Upload date||Hashes View|
|Filename, size nutsflow-1.0.35.tar.gz (45.7 kB)||File type Source||Python version None||Upload date||Hashes View|
Hashes for nutsflow-1.0.35-py2.py3-none-any.whl