[Python-ideas] Dynamic code NOPing

Greg Ewing greg.ewing at canterbury.ac.nz
Tue Dec 25 22:49:54 CET 2012


Rene Nejsum wrote:
> Interessting alternatives, but they do not quite come on as 
> flexible/usefull enough…
> 
> Often debug statements have a lot of text and variables, like:
> 
> log.debug( "The value of X, Y, Z is now: %d %s %d" % ( x, lookup(y), 
> factorial(2**15))

That needn't be a problem:

    log.lazydebug(lambda: "The value of X, Y, Z is now: %d %s %d" %
       (x, lookup(y), factorial(2**15)))

-- 
Greg



More information about the Python-ideas mailing list