Created
July 31, 2014 02:03
-
-
Save harlowja/f4e3909928b741285992 to your computer and use it in GitHub Desktop.
nested_test.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from taskflow.types import fsm | |
import six | |
a = fsm.FSM("start") | |
a.add_state('start') | |
b = fsm.FSM("boop") | |
b.add_state("boop") | |
b.add_state("dink") | |
b.add_transition("boop", "dink", 'bump') | |
a.add_state("middle", nested_machine=b) | |
a.add_reaction("middle", "go", lambda *args: "bump") | |
a.add_transition("start", "middle", "go") | |
m = a.run_iter('go') | |
print(six.next(m)) | |
print(six.next(m)) | |
print(six.next(m)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment