15
Spent 6 months debugging Python the hard way before I found print statements actually work better than debuggers for beginners.
Everyone kept telling me to use VS Code's debugger, but it just confused me more. Just writing print(f"variable: {var}") at each step finally helped me spot my logic bug in a loop after 3 tries. Has anyone else found that simpler tools click better when you're starting out?
3 comments
Log in to join the discussion
Log In3 Comments
allen.kai21d agoMost Upvoted
Same thing happened to me when I was learning JavaScript. Everyone pushed the browser dev tools and breakpoints but I just couldn't get the hang of it. Started using alert() and console.log everywhere and suddenly it all made sense. There's something about seeing values spit right there in front of you that helps your brain connect the dots way faster than clicking through a debugger.
7
wilson.joseph21d ago
Oh did you ever try putting breakpoints inside print statements themselves? I got so frustrated with debuggers that I started doing that hack where you put a breakpoint right before a print then step through it manually. Eventually I just started wrapping every variable in a formatted string like f"DEBUG: i={i}, total={total}" and piping it to a text file. Now I basically write my own log files before even starting the real code. The best part is you can grep through them later to find patterns you wouldn't catch live.
2