end of print = lower productivity ?

Diez B. Roggisch deets at nospam.web.de
Tue Nov 25 10:53:42 EST 2008


cptnwillard at gmail.com wrote:

> I want my productivity back.
> 
> In Python 2.x, I could easily write things like -- print "f" / print
> "add" / print "done" -- to a lot of different places in my code, which
> allowed me to find bugs that I could not track otherwise. When I found
> out that "f" was not at fault, I could write -- print "g" -- to some
> other place... etc, so that a significant part of the time spent
> debugging was actually used to write print statements.
> 
> Now the print statement disappeared, and I have to write print("f")
> instead. These parentheses not only take time to write, they also make
> me think twice about using print for debugging purposes. Pressing <
> SHIFT > then < ( > then < " > makes the whole process quite a hassle.
> 
> I agree with most of the arguments that have been made against using
> the print statement to build code, but I did care about the efficient
> debugging tool it was.

I used to use print a lot. Once I found

import pdb; pdb.set_trace()

I massively lost interest in it. And gained *much* more debugging
power/productivity.

Also, using logging instead of print allows you to keep the output producing
statements in your code, while turning them on only if things get fishy.

Diez



More information about the Python-list mailing list