author | Alberto Bertogli
<albertito@gmail.com> 2007-01-31 16:32:14 UTC |
committer | Alberto Bertogli
<albertito@gmail.com> 2007-01-31 16:32:14 UTC |
parent | b18d4795b5587de5cb4189771120f8334be12103 |
samples/adatasks/sample4.py | +14 | -0 |
samples/dataflow/sample3.py | +14 | -0 |
samples/lazy/sample2.py | +12 | -0 |
diff --git a/samples/adatasks/sample4.py b/samples/adatasks/sample4.py new file mode 100644 index 0000000..df774b3 --- /dev/null +++ b/samples/adatasks/sample4.py @@ -0,0 +1,14 @@ +#!/usr/bin/env python + +import adatasks + +@adatasks.task +def f(): + print f.accept("msg1"), f.select("msg2", "msg3") + +adatasks.launch() +f.msg1('Hello', 'world!') +f.msg3("How's it going?") + +adatasks.wait_for_all() + diff --git a/samples/dataflow/sample3.py b/samples/dataflow/sample3.py new file mode 100644 index 0000000..4e231f2 --- /dev/null +++ b/samples/dataflow/sample3.py @@ -0,0 +1,14 @@ + +import time +from dataflow import dataflow + +@dataflow +def f(x): + time.sleep(2) + return x + +r1 = f(1) +r2 = f(2) + +print r1, r2 + diff --git a/samples/lazy/sample2.py b/samples/lazy/sample2.py new file mode 100644 index 0000000..6f82651 --- /dev/null +++ b/samples/lazy/sample2.py @@ -0,0 +1,12 @@ + +import lazy + + +@lazy.lazy +def f(x): + return x + +r = f(x) # r has a "lazy object" +print r # f is run here + +