https://github.com/jonathanj/compose
No frills Python function composition
https://github.com/jonathanj/compose
Last synced: about 2 months ago
JSON representation
No frills Python function composition
- Host: GitHub
- URL: https://github.com/jonathanj/compose
- Owner: jonathanj
- License: mit
- Created: 2015-06-04T12:46:02.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2016-02-04T17:43:46.000Z (over 10 years ago)
- Last Synced: 2025-12-28T01:12:54.360Z (6 months ago)
- Language: Python
- Size: 4.88 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
- License: LICENSE
Awesome Lists containing this project
README
===============================================
Compose: No frills Python function composition.
===============================================
*Important*
If you prefer to write Python code in a more functional style you may find the
toolz_ package to be more useful, it includes a `compose` function as well as
several functions conducive to writing functional code in Python.
.. _toolz: https://pypi.python.org/pypi/toolz
No magic operators or special objects just a function with unit tests. Here is a
wonderfully contrived example to whet your appetite:
.. code-block:: pycon
>>> import json
>>> from compose import compose
>>> from operator import itemgetter
>>> compose((3).__mul__, next, iter, itemgetter('b'), json.loads)('{"a": 1, "b": [2, 3]}')
6
Contribute
==========
See http://github.com/jonathanj/compose for development.
Installation
============
.. code-block:: console
$ pip install compose-func