不明白哪里错了,求大神解答
import time
def performance(unit):
def performance1(f):
def fn(*args,**kw):
t1=time.time()
r=f(*args,**kw)
t2=time.time()
if (unit=='ms'):
print 'call %s() in %f %s'(f.__name__,(t2-t1)*1000,unit)
print 'call %s() in %f %s'(f.__name__,(t2-t1),unit)
return r
return fn
return performance1
@performance('ms')
def factorial(n):
return reduce(lambda x,y: x*y, range(1, n+1))
print factorial(10)