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

Function trace

example_code/item_038.py:51–61  ·  view source on GitHub ↗
(func)

Source from the content-addressed store, hash-verified

49
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
63
64print("Example 2")

Callers 1

item_038.pyFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected