pydash¶
Python port of the Lo-Dash Javascript library.
Links¶
- Project: https://github.com/dgilland/pydash
- Documentation: http://pydash.readthedocs.org
- PyPi: https://pypi.python.org/pypi/pydash/
- TravisCI: https://travis-ci.org/dgilland/pydash
Quickstart¶
>>> import pydash as pyd
# Arrays
>>> pyd.flatten([1, 2, [3, [4, 5, [6, 7]]]])
[1, 2, 3, 4, 5, 6, 7]
# Collections
>>> pyd.pluck([{'name': 'moe', 'age': 40}, {'name': 'larry', 'age': 50}], 'name')
['moe', 'larry']
# Functions
>>> curried = pyd.curry(lambda a, b, c: a + b + c)
>>> curried(1, 2)(3)
6
# Objects
>>> pyd.omit({'name': 'moe', 'age': 40}, 'age')
{'name': 'moe'}
# Utilities
>>> pyd.times(3, lambda index: index)
[0, 1, 2]
# Chaining
>>> pyd.chain([1, 2, 3, 4]).without(2, 3).reject(lambda x, *args: x > 1).value()
[1]
See also
For further details consult API Reference.
API Reference¶
Includes links to source code.