请打神指教,为什么我的运行结果打印了无数次 t ?
import time
def performance(unit):
def performance1(f):
def performance2(*args, **kw):
t = time.ctime() *1000 if unit =='ms' else time.time()
print 'call '+f.__name__+'() in',t,unit
return f (*args, **kw)
return performance2
return performance1
@performance('ms')
def factorial(n):
return reduce(lambda x,y: x*y, range(1, n+1))
print factorial(10)