Programming in C
I used to have code sections only used for debugging purposes (logging commands and the like). Those statements could be completely disabled fo
As far as I am aware, you have to use actual if
statements. There is no preprocessor, so there is no analogue to preprocessor directives.
Edit: Actually, it looks like the top answer to this question will be more illuminating: How would you do the equivalent of preprocessor directives in Python?
Supposedly there is a special variable __debug__
which, when used with an if
statement, will be evaluated once and then not evaluated again during execution.