应该不用用多个参数吧
import time
import datetime
def performance(f):
def fn(x):
starttime=datetime.datetime.now()
r=f(x)
endtime=datetime.datetime.now()
print endtime-starttime
return r
return fn
@performance
def factorial(n):
return reduce(lambda x,y: x*y, range(1, n+1))
print factorial(10)
网上查了只有datetime的用法...凑合用上了