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
.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.2.0.tar.gz
(2.8 kB
view hashes)
Built Distribution
Close
Hashes for composetools-0.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2e45fe24d90f735e1f0b5194f1f0c3e063889d5fe93fd6534b93698758713ff1 |
|
MD5 | 2f7230a1642ae19aad63183ebe196ae2 |
|
BLAKE2b-256 | 1141be03fc49e66a7a7a51f0738c1867aeac2d830124a3c5b368436c7a62fcad |