import time
def timer(f):
def subfunc(*args, **kwargs):
t = time.time()
res = f(*args, **kwargs)
res_3 = (time.time() - t)
mylist = [args[0].__name__, args[1], res_3]
print(mylist)
return res
return subfunc
@timer
def myfunc(expression, i=1000, sleep=2, args=[]):
time.sleep(sleep)
res_1 = expression(j for j in range(1, 10001))
res_2 = res_1 * i
return res_2
myfunc(sum, 20000)
myfunc(min, 20000)