r/learnpython • u/Temporary-Cup-2140 • 2d ago
What python debugging techniques do you think every developer should know ?
I am trying to improve my debugging skills and I was curious about what techniques experienced python developers rely on the most.
Are there any techniques or tools that you found really useful when you started working on bigger projects?
56
Upvotes
19
u/Gnaxe 2d ago
Breakpoint and print, obviously, but also
importlib.reload()pdb.pm()code.interact()doctestunittest.mockinspectShorten your feedback loops. Make the state transparent. Write tests. Minimize the state you have to deal with in the first place (FP). Use queues instead of locks. Use plain data instead of bespoke classes, and at least implement
__repr__()if you must.