DEV Community

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

 
samuraiseoul profile image
Sophie The Lionhart

That works in python, but for other langs it won't. In addition the debugger should not be any more time consuming than the print statement. Add the break point and run the program, you have to type the print and run the program anyways. If its too hard then you have some other problem in your workflow to work out. You also run the risk of forgotten print statements and logging. enough of those especially in a loop can absolute MURDER performance. Print statements for debugging are no faster than debugging, but they are more dangerous.

Thread Thread
 
yaser profile image
Yaser Al-Najjar

In addition the debugger should not be any more time consuming than the print statement

I developed recently in django and spinning the debugger takes more time than printing and re-running the app.

It always depends, sometime running the shell and trying things out there is really much faster.

Print statements for debugging are no faster than debugging, but they are more dangerous

When you try this stuff in Android development (esp. Xamarin Android), you will change this line :D

enough of those especially in a loop can absolute MURDER performance

Generally you won't test a loop or an algorithm by hand / debugger, you would write logical tests against it... and run those tests till you get green ;)