def one(f):
def wrapper():
print('i am 1')
f()
return wrapper
def three(f):
def wrapper():
print('i am 3')
f()
return wrapper
def two(f):
def wrapper():
# print('i am 2')
return 222
return wrapper
@one
@two
@three
def printout():
print("finally")
print(printout())
I cannot understand the result, I think the flow would be printing I am 1 then return 222, print I am 3 then run original printout()
thus I think this should print
i am 1 n
222
However, it prints
i am 1 n
None
New contributor
Jonas Zhang is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.