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
4
u/nicholashairs Sep 20 '26
It would incur a penalty, but for most use cases it would be negligible, checking if a log level is activated should be a super fast evaluation. If you really are concerned about such performance then you should already be benchmarking and doing tricks to strip them out.
The one exception is if building your log line is expensive in which case you should put it in a guard that is fast: