H
21

Someone told me to stop debugging print statements and use the debugger instead

My friend Sarah from the local coding meetup kept saying I needed to learn how to use the debugger in VS Code for my Python scripts. I ignored her for like 3 months because print statements felt faster, but then I spent 2 hours hunting a bug that the debugger found in 2 minutes. Has anyone else had that moment where a basic tool you avoided actually saved you a ton of time?
2 comments

Log in to join the discussion

Log In
2 Comments
the_mason
the_mason25d ago
Print statements are WAY more flexible than people give them credit for. You can toss them anywhere instantly and they don't break your flow or need you to learn some new interface. The debugger makes you stop everything, set breakpoints, step through code line by line, and it totally kills your momentum when you're in the zone. Plus half the time the debugger gives you some cryptic error that takes longer to understand than just reading your own print output. I've had situations where the debugger refused to work right with multiprocessing or certain libraries, but a well placed print statement never fails. Print statements work everywhere on any machine with zero setup, try doing that with a debugger on a remote server. It's not like print statements are the only tool you need, but acting like they're useless is just wrong. There's a reason experienced devs still use them all the time, they're simple and they WORK.
5
susan_wells
Print statements lied to me for years before I finally trusted the debugger.
1