[Python-ideas] Efficient debug logging
barry at barrys-emacs.org
Wed Feb 15 06:32:44 EST 2017
On Tuesday, 14 February 2017 22:00:31 GMT Barry wrote:
> > On 14 Feb 2017, at 17:39, Kyle Lahnakoski <klahnakoski at mozilla.com> wrote:
> > Can you wrap the expensive functions in lambdas? And have your logger
> > evaluate it, only if required?
> >> debugLog( ‘info is %r’ % (lambda: expensiveFunction(),) )
> Interesting idea. I will bench mark and see what the cost of the lamba
> version is. It would still be nice to have the code look cleaner without
> the lambda.
Benchmarks show that the lambda idea works well. Its not that much more
expensive the the if enabled version.
More information about the Python-ideas