Skip to content

Commit ede836e

Browse files
committed
committed from zkp
1 parent 969408a commit ede836e

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

FluentPython/deco_1.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
registry = []
2+
3+
4+
def register(func):
5+
print('running register(%s)' % func)
6+
registry.append(func.__name__)
7+
return func
8+
9+
10+
@register
11+
def f1():
12+
print("running f1()")
13+
14+
15+
@register
16+
def f2():
17+
print("running f2()")
18+
19+
20+
def f3():
21+
print("running f3()")
22+
23+
24+
def main():
25+
print("running main()")
26+
print("registry ->", registry)
27+
f1()
28+
f2()
29+
f3()
30+
31+
32+
if __name__ == '__main__':
33+
main()

0 commit comments

Comments
 (0)