使用装饰器计算函数运行时间
https://www.zhihu.com/people/logan-93-60
import timefrom functools import wrapsdef timer(fun):@wraps(fun)def timer(*args, **kwargs):start = time.time()fun(*args, **kwargs)end = time.time()print("run time", end-start)return timer@timerdef fun(*args, **kwargs):time.sleep(1.1)fun()
使用 @property
https://www.liaoxuefeng.com/wiki/1016959663602400/1017502538658208
