sugar.py

version travis coveralls license

Python utility library. Based on sugar Javascript Library.

Features

  • Supported on Python 2.7 and Python 3.3+.

Quickstart

Install using pip:

pip install sugar.py
>>> import sugar

>>> float(sugar.average([1, 2, 3]))
2.0

>>> sugar.construct(4, lambda x: x * 2)
[0, 2, 4, 6]

>>> sugar.count([1, 2, 3, 3], 3)
2

>>> sugar.subtract([1, 2, 3], 2)
[1, 3]
>>> sugar.subtract ([1, 2, 3], [1, 3])
[2]
>>> sugar.subtract([1, 2, 3], 4)
[1, 2, 3]

Indices and tables