#功能函数
def add(x,y):
return x+y
#装饰函数
def logger(fn):
print('frist')
x = fn(4,5)
print('second')
return x
print(logger(add))
#把函数add传给logger ,return x+y
#print('frist')
#print('secend')
# x = fn(4,5) ==> x = 4 y= 5 x= 4+5 = 9
#return 9
frist
second
9
网友评论