-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexamples.py
More file actions
31 lines (25 loc) · 847 Bytes
/
examples.py
File metadata and controls
31 lines (25 loc) · 847 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
from state_func import *
@state_func
def test(self, a, b,c):
try:
self.count += 1
except:
self.count = 0
print(a,b,c, self.count)
test("hi", "hello", "goodbye") # hi hello goodbye 0
test("hi", "hello", "goodbye") # hi hello goodbye 1
test("hi", "hello", "goodbye") # hi hello goodbye 2
@state_func_e({"count":0})
def test2(self, a, b,c):
print(a,b,c, self.count)
self.count += 1
test2("hi", "hello", "goodbye") # hi hello goodbye 0
test2("hi", "hello", "goodbye") # hi hello goodbye 1
test2("hi", "hello", "goodbye") # hi hello goodbye 2
@state_func_i(test2)
def test3(self, a, b,c):
print(a,b,c, self.count)
self.count += 1
test3("hi", "hello", "goodbye") # hi hello goodbye 0
test3("hi", "hello", "goodbye") # hi hello goodbye 1
test3("hi", "hello", "goodbye") # hi hello goodbye 2