关于自己写的代码,为什么没有print call.....,求大神
#coding=utf8
import time, functools
def performance(unit):
def fn(f):
@functools.wraps(f)
def wrapper(*args,**kw):
t1 = time.time()
kk = f(*args,**kw)
t2 = time.time()
print 'call %s ()in %s %s' % (f.__name__ , t2-t1, unit) if unit == 's' else (t2 - t1)*1000
return kk
return wrapper
return fn
@performance('ms')
def factorial(n):
return reduce(lambda x,y: x*y, range(1, n+1))
print factorial(3)
print factorial.__name__