Python 装饰器:记录函数调用 - 实现函数调用追踪
def record(func): def wrapper(*args, **kwargs): print('Call function: ' + func.name) return func(*args, **kwargs) return wrapper
@record def func1(): print('This is function 1')
@record def func2(): print('This is function 2')
func1() func2()
原文地址: https://www.cveoy.top/t/topic/nx6F 著作权归作者所有。请勿转载和采集!