Re: Using debug print routine inside assert

From: Peter Hansen (peter_at_engcorp.com)
Date: 11/04/03


Date: Tue, 04 Nov 2003 08:33:17 -0500

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