# tracefunc > See what a Python function did, line by line: how many times each line ran and what the variables held. Use when working out why code takes a branch, loops, recurses, or computes a wrong value, without changing that code or stepping through a debugger. Base URL: https://AnswerDotAI.github.io/tracefunc/ - source reading doesn't settle it: one `tracefunc` call returns the whole run as data ```python from tracefunc import tracefunc def wrapper(n): return sum(target(i) for i in range(n)) traces = tracefunc(wrapper, 3, target_func=target) for stack, trace in traces: print(stack) for snippet, (hits, vars_) in trace.items(): print(snippet, hits, vars_) ``` - branch never taken: `incl_unhit=True` - runaway recursion: lower `sys.setrecursionlimit` first /run ends fast ## API - [tracefunc.core](api/core.md): Line-by-line Python execution tracing with hit counts and per-variable snapshots via `sys.monitoring`.