Debugging Python
summary
Immediate, practical steps: stop and breathe, confirm the code path actually runs, reproduce the bug reliably, and inspect state and stack traces step by step rather than guessing. Start with low‑friction prints (claim: print is the best first tool) using f'{var=}' and !r* for repr, then try Snoop for automatic line/state dumps, pdb/ipdb/pudb or web‑pdb for interactive stepping, and Bird’s Eye to record and inspect intermediate values across iterations. Set PYTHONBREAKPOINT=0 to avoid accidental production breakpoints and use rubber‑duck explanation to surface missing assumptions.
AI-written summary · about
