Utility functions for common tasks when composing functions.
Project description
composetools
A library of utility functions for Pythonic function composition.
Most utilities are focused on transforming and dealing with iterables.
Install
pip install composetools
Functions
-
compose
Compose functions such that
compose(f, g)(x)
is equivalent tog(f(x))
-
pipe
Compose functions such that
pipe(f, g)(x)
is equivalent tof(g(x))
Utilities
unique
- Yield unique items of an iterable.each
- Curriedmap
.keep
- Curriedfilter
.mask
- Currieditertools.compress
.drop
- Currieditertools.filterfalse
.sort
- Curriedsorted
.flat
- Flatten an arbitrarily nested iterable to a desired depth.also
- Call a function and return its input, eg.also(print)(4)
will print 4 and return 4.
Develop
$ gh repo clone SeparateRecords/python-composetools
$ poetry install
$ poetry run python -m pytest tests.py
Licence
ISC
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
composetools-0.3.0.tar.gz
(2.9 kB
view hashes)
Built Distribution
Close
Hashes for composetools-0.3.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1ed4749326e3dead6f7c8b3c9b624a1f3dac8d2acc1771a167f6078b788858cd |
|
MD5 | 947734c440dfc6f2d8a9a88ead464e65 |
|
BLAKE2b-256 | 0948286aa4a076b092e0e2503e997cfc6dd2dba0d243587321ded0e7c10fb6c7 |