Recipes for trace statements inside python programs?

Francesco Bochicchio bieffe62 at
Thu Jun 25 04:40:01 EDT 2009

Sorry, hit the send button by mistake ...
The definition of the trace function should be like:

if __debug__ :
   def TRACE(*args):
     if  trace_enabled(): print "TRACE(%s) : %s " % ( context(),
                              " ".join( str(x) for x in args ) )
else : # optimazed code, only a function call performance penalty
   def TRACE(*args): pass

If I don't find anything suitable, maybe I will bake my own again,
time aiming to something that I can reuse ...

Ciao and thanks for any tip/suggestion

More information about the Python-list mailing list