MCPcopy Create free account
hub / github.com/bslatkin/effectivepython / wrapper

Function wrapper

example_code/item_038.py:52–59  ·  view source on GitHub ↗
(*args, **kwargs)

Source from the content-addressed store, hash-verified

50print("Example 1")
51def trace(func):
52 def wrapper(*args, **kwargs):
53 args_repr = repr(args)
54 kwargs_repr = repr(kwargs)
55 result = func(*args, **kwargs)
56 print(f"{func.__name__}"
57 f"({args_repr}, {kwargs_repr}) "
58 f"-> {result!r}")
59 return result
60
61 return wrapper
62

Callers

nothing calls this directly

Calls 1

funcFunction · 0.85

Tested by

no test coverage detected