r/Python • u/Harshita_Netla • Sep 19 '26
Discussion What’s a debugging technique that saved you hours and you wish you’d learned earlier?
I’m curious about the small debugging techniques that make a big difference when working on real projects.For developers with some experience, what debugging technique or habit has saved you the most time?It could be something simple that beginners often overlook.
What’s one debugging tip you wish someone had taught you when you were starting out?
151
Upvotes
View all comments
Show parent comment
3
u/DNSGeek Sep 20 '26
Also, use % string concatenation with the logging module. It has its own string evaluator, so if the level isn't going to be logged the string is never evaluated.
logging.debug("name=%s" % name)