updated from Atlas
This commit is contained in:
27
attic/decorators/stacked_demo.py
Normal file
27
attic/decorators/stacked_demo.py
Normal file
@@ -0,0 +1,27 @@
|
||||
def d1(f):
|
||||
def wrapped():
|
||||
print('d1/wrapped')
|
||||
return f()
|
||||
return wrapped
|
||||
|
||||
|
||||
def d2(f):
|
||||
def wrapped():
|
||||
print('d2/wrapped')
|
||||
return f()
|
||||
return wrapped
|
||||
|
||||
|
||||
@d1
|
||||
@d2
|
||||
def f():
|
||||
print('f')
|
||||
|
||||
f()
|
||||
|
||||
def g():
|
||||
print('g')
|
||||
|
||||
g = d1(d2(g))
|
||||
|
||||
g()
|
||||
Reference in New Issue
Block a user