【发布时间】:2019-04-16 19:06:14
【问题描述】:
这是一个关于装饰器的简单练习,但我不明白为什么在这种情况下我不能打印出函数输出,其中这两行代码分别写在最后 x=f1 - x(f3) 但它在这样写 x=f1(f3)- x()
def f1(f):
def f2():
print (f'this is before the function call')
f()
print (f'this is after the function call')
return f2
def f3():
print('this is f3')
x=f1 |the other scenario| x=f1(f3)
x(f3) |the other scenario| x()
【问题讨论】: