- authors
Antti Kaihola
- organization
Eniram Ltd
- copyright
2013 Eniram Ltd. See the LICENSE file at the top-level directory of this distribution and at https://github.com/akaihola/lusmu/blob/master/LICENSE
Documentation | Source code | PyPI | Download | License
Lusmu is a Python library for reactive programming (a form of dataflow programming). Operations on data are done using a directed graph which consists of input nodes and calculation nodes.
Lusmu uses the invalidate/lazy-revalidate evaluation model: reading the value of a node triggers its calculation action and reads the values of its inputs. Thus, only required calculations are executed.
from lusmu.core import Input, Node, update_inputs
root = Input()
square = Node(action=lambda x: x ** 2,
inputs=Node.inputs(root))
update_inputs([(root, 5)])
print square.value
The output:
25
See mouse.py and triangle.py for more comples examples.