[Python-ideas] Efficient debug logging
g.rodola at gmail.com
Thu Feb 16 09:24:54 EST 2017
On Thu, Feb 16, 2017 at 1:55 PM, M.-A. Lemburg <mal at egenix.com> wrote:
> Some comments:
> 1. you don't need a preprocessor for this: simply put your
> logging code into an "if __debug__:" block:
> and then run your production code with "python -O"
> (the trick here is that the Python byte code compiler will
> not even generate code for such ifs)
I didn't know about if __debug__ + -O:.
Unbelievable after so many years.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-ideas