F
18

I kept using print() to debug my Python loops and it was a mess

Switched to using the debugger in VS Code last week and it was way clearer. I could actually see the variable values change step by step instead of getting a wall of text. Anyone have other beginner-friendly debugging tips?
4 comments

Log in to join the discussion

Log In
4 Comments
evan_cooper73
Print debugging gets a bad rap but it works fine for small scripts. Sometimes you just need to see if a loop ran three times or four, and adding a breakpoint feels like overkill. My old code is full of prints that I just commented out later. For a beginner, getting the debugger set up can be more confusing than a few messy print lines.
6
hayden_craig95
But "confusing clutter" seems a bit dramatic for some old print lines.
7
thomas_sanchez
The problem is leaving them in. Uncommented print statements become confusing clutter later on.
1
shane_hayes
Evan's point about old code being full of commented-out prints is so real. It reminds me of how we all have these temporary fixes in life, like using a cookbook to prop up a wobbly table. It works right now, but you never go back to actually fix the leg. Learning the proper tool, like a debugger, feels like a hassle at first but saves so much clutter later.
2