DEV Community

Discussion on: Using Print Statements Are A Handy Way to Debug and Explore Code

Collapse
 
aezore profile image
Jose Rodriguez

I'm mainly a Python programmer for embedded electronics and hex files voodoo so I tend to use a lot of print statements pretty much everywhere while debugging, I used the logging module too but for a more "rock solid" debugging purpose where I expect things to fail. But for the casual quick'n dirty "why the f*** is this not doing what I want" I plague the blamed chunk of code full of prints; once I figure it out I remove them and put a more sensible logging code for next time. So far I haven't got much trouble (if any) although I'm not used to production and all my work is mainly in-house dev and precise problem solving.

I tried the debugger a few times but...since I do a lot of cross-programing (writing code in my computer and running it on a raspberry) modern debuggers are more clumsy than a straight print. I'm still learning on my own so I can only talk about my actual know-how and experience. Maybe someone can point out a better approach?