Files
2020-07-29 12:59:12 +02:00

14 lines
394 B
Python

import time
def timer(function):
"""Print the duration of a function making use of decorators."""
def function_(*args,**kwargs):
"""Tested function."""
ti=time.time()
result=function(*args,**kwargs)
tf=time.time()
dt=tf-ti
print("[TIMER]: "+str(function.__name__)+" took "+str(dt)+" seconds.")
return result
return function_