Using debug print routine inside assert
Peter Hansen
peter at engcorp.com
Tue Nov 4 08:33:17 EST 2003
Edvard Majakari wrote:
>
[snip problem]
> What do you think, what is the best solution for this kind of problem? I
> for one wouldn't like to see myself writing assert(debug(...)) every now
> and then :)
My solution has been to dispense completely with "debugging code"
except *during* debugging (when a print or two might appear temporarily,
or a call to pdb.set_trace()), and instead do all my development using
unit tests.
With adequate use of the "unittest" standard module, I haven't encountered
any reason to call one of those old debug() routines or have a global
"debug level" variable for eons...
(I'm sorry that my advice is pretty much to change the way you do
development, but it has worked for me.)
-Peter
More information about the Python-list
mailing list