如何正确理解这三个return,个人理解在代码注释
import time def performance(unit): def log_decorator(f): def fn(*args, **kw): t1=time.time() r=f(*args, **kw) t2=time.time() print 'call %s() in %f%s' % (f.__name__,t2-t1,unit) return r # 返回f函数,即x*y? return fn # 闭包?为了传参不受限制? return log_decorator # 闭包? @performance('ms') def factorial(n): return reduce(lambda x,y: x*y, range(1, n+1))print factorial(10)