A collection of useful algorithms and data structures
Project description
Sweetener
Sweetener is a Python library that contains some generic algorithms and data structures. Extra care has been taken to make the algorithms as flexible as possible to fit as many use cases. If you're still missing something, do not hesitate to file an issue!
In particular, this library contains the following goodies:
- Generic procedures like
clone
,equal
andlte
that work on most types in the standard library and you can specialize for your own types. - A typed record type that allows you to very quickly define a new data structure with some built-in validation.
- A generic representation for parse trees that allows you to define, query and manipulate individual nodes with ease.
Examples
from sweetener import Record, equal, visualize
class MySimpleRecord(Record):
field_1: int
field_2: str
r1 = MySimpleRecord('foo', 42)
r2 = MySimpleRecod(field_1='foo', field_2=42)
assert(equal(r1, r2))
visualize(r1)
Running this program will open a new window with the following content:
License
Sweetener is generously licensed under the MIT license, in the hope that it inspires people to build new and cool software.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
sweetener-0.1.0.tar.gz
(12.9 kB
view hashes)