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

Function wrapper

src/9/defining_decorators_as_classes/example3.py:9–14  ·  view source on GitHub ↗
(*args, **kwargs)

Source from the content-addressed store, hash-verified

7def timethis(func):
8 @wraps(func)
9 def wrapper(*args, **kwargs):
10 start = time.time()
11 r = func(*args, **kwargs)
12 end = time.time()
13 print(func.__name__, end - start)
14 return r
15 return wrapper
16
17def profiled(func):

Callers

nothing calls this directly

Calls 1

funcFunction · 0.50

Tested by

no test coverage detected