1 min readAug 7, 2020
pdb should be your last resort. Though it's really important to have that last resort.
When I have a bug, these days my first line of attack is to re-read the code in detail, putting in a few logging statements. 60% of the time I find the bug before I ever see a single logging statement. Nearly all the rest of the time, I find the bug from a couple of runs.
Occasionally, I'm still confused. Much of the time, it means I just didn't understand what I was doing. Sometimes that means I just rewrite that section entirely. Or sometimes I use pdb then.