macro preprocessor, for debugging information
Phil Hunt
philh at vision25.demon.co.uk
Sun May 2 21:25:22 EDT 1999
Imagine I'm writing some code with debugging information:
debug = 1 \turn debugging on/off
def myFunction(a)
if debug: print 'running myFunction() a =', a
#...rest of myFunction...
When I have finished debugging, I can set debug to 0 and it no longer
prints the debugging info. All well and good. But I'm still left with
the run-time overhead of executing the ``if debug'' statement exery
time I call myFunction(). Is there any way to avoid the overhead,
e.g. like C's:
#if DEBUG
printf("a = %d\n", a);
#endif
I imagine it wouldn't be that difficult in Python to intercept the
function call when debugging is on, and print out the parameters then,
but I'm looking for a more general solution, e.g. one that can print
debugging information in the middle of a function.
--
Phil Hunt....philh at vision25.demon.co.uk
More information about the Python-list
mailing list