zhangkaixu / lazydag

A Directed Acyclic Graph for lazy evaluation for Python

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

lazydag

A Directed Acyclic Graph for lazy evaluation for Python

from lazydag.lazyclass import lazyclass

@lazyclass
class DAG:
    def sum(a, b):
        return a + b
    def double(sum):
        return sum * 2

dag = DAG(a=4, b=3)
self.assertTrue(dag.sum==7)     # `sum` was calculated in this line
dag.set(a=5)                    # reset `a`
self.assertTrue(dag.double==16) # `sum` was calculated again in this line

About

A Directed Acyclic Graph for lazy evaluation for Python

License:Creative Commons Zero v1.0 Universal


Languages

Language:Python 100.0%