321 bytes added
, 08:44, 14 February 2022
== Timeit decorator ==
<syntaxhighlight lang="python3">
import time
def timeit(method):
def timed(*args, **kw):
ts = time.time()
result = method(*args, **kw)
te = time.time()
print(f'{method.__name__} {(te - ts) * 1000} ms')
return result
return timed
</syntaxhighlight>