
Dec. 30, 2012
10:58 a.m.
Victor Stinner, 30.12.2012 11:42:
My astoptimizer provides tools to really *remove* debug at compilation, so the overhead of the debug code is just null.
You can for example declare your variable project.config.DEBUG as constant with the value 0, where project.config is a module. So the if statement in "from project.config import DEBUG ... if DEBUG: ..." will be removed.
How would you know at compile time that it can be removed? How do you handle the example below? Stefan ## constants.py DEBUG = False ## enable_debug.py import constants constants.DEBUG = True ## test.py import enable_debug from constants import DEBUG if DEBUG: print("DEBUGGING !")