Recipes for trace statements inside python programs?

koranthala koranthala at gmail.com
Thu Jun 25 07:15:23 EDT 2009


On Jun 25, 1:40 pm, Francesco Bochicchio <bieff... at gmail.com> wrote:
> 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,
> this
> time aiming to something that I can reuse ...
>
> Ciao and thanks for any tip/suggestion
> ------
> FB

Is assert what you are looking for?



More information about the Python-list mailing list