On Thu, Feb 16, 2017 at 1:55 PM, M.-A. Lemburg <m...@egenix.com> wrote:

> Some comments:
>
>  1. you don't need a preprocessor for this: simply put your
>     logging code into an "if __debug__:" block:
>
> https://docs.python.org/3.6/reference/simple_stmts.html?
> the-assert-statement#grammar-token-assert_stmt
>     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.
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to