A primer on Python's debugger
PDB is better than
When we tackle a Python bug, e.g. in a Python script or module, we tend to search the respective source code and decorate it with well-beloved
Before we dive into the wondrous world of
pdb, let me give my basic debugging workflows:
- Orientation and Inspection
- Where am I? Stack trace, source listing. What are the arguments and local variables?
- Interruption and Stepping
- Interrupt my program at a specific point, with and without an condition. Moving inside my execution in specific ways (with and without conditions).
- Change of the exeuction flow? Change of variables? Inserting program code.
We can debug a running program, or inspect its "corpse", post-mortem as the docstrings of
pdb call it.
More on its way…