On Tuesday, 14 February 2017 22:00:31 GMT Barry wrote:
> > On 14 Feb 2017, at 17:39, Kyle Lahnakoski <[email protected]> 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.

Barry

_______________________________________________
Python-ideas mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to