<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Feb 16, 2017 at 1:55 PM, M.-A. Lemburg <span dir="ltr"><<a href="mailto:mal@egenix.com" target="_blank">mal@egenix.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Some comments:<br>
<br>
1. you don't need a preprocessor for this: simply put your<br>
logging code into an "if __debug__:" block:<br>
<br>
<a href="https://docs.python.org/3.6/reference/simple_stmts.html?the-assert-statement#grammar-token-assert_stmt" rel="noreferrer" target="_blank">https://docs.python.org/3.6/<wbr>reference/simple_stmts.html?<wbr>the-assert-statement#grammar-<wbr>token-assert_stmt</a><br>
and then run your production code with "python -O"<br>
(the trick here is that the Python byte code compiler will<br>
not even generate code for such ifs)</blockquote><div><br></div><div>I didn't know about if __debug__ + -O:. </div><div>Unbelievable after so many years. </div></div>
</div></div>