pdb
Python's built-in command-line debugger, reached with breakpoint() or python -m pdb script.py.
In more detail
At the (Pdb) prompt the commands worth memorising are n next line, s step into a call, c continue, p expression print a value, l list code, w where am I in the call stack, and q quit. You can type any Python expression to inspect state.
Example
(Pdb) p total
(Pdb) nRelated terms
- breakpoint — A marked place in a program where execution pauses so you can inspect it in a debugger.
- stack frame — The block of memory for one function call on the call stack, holding that call's local variables and return point.
Taught in
- Debugging: print, breakpoint, and the debugger — Hands-on Python: Complete Video Course & Book