MCPcopy
hub / github.com/dabeaz/python-cookbook / wrapper

Function wrapper

src/14/profiling_and_timing_your_program/timethis.py:8–13  ·  view source on GitHub ↗
(*args, **kwargs)

Source from the content-addressed store, hash-verified

6def timethis(func):
7 @wraps(func)
8 def wrapper(*args, **kwargs):
9 start = time.perf_counter()
10 r = func(*args, **kwargs)
11 end = time.perf_counter()
12 print('{}.{} : {}'.format(func.__module__, func.__name__, end-start))
13 return r
14 return wrapper
15
16if __name__ == '__main__':

Callers

nothing calls this directly

Calls 1

funcFunction · 0.50

Tested by

no test coverage detected