preprocessor for Python?

alex alex at somewhere.around.here
Thu Nov 25 05:51:36 CET 1999


> I'm looking for some macro facilities so I can include debug
> statements that are removed when I need to test performance.

There was a post a while back where it was stated that the __debug__
variable is evaluated at compile time, and blocks beginning with

if 0: 

are not compiled.  So if you set __debug__=0, then any block beginning
with 

if __debug__:

will not be compiled into the program.  You can probably get the
straight dope by searching for __debug__ on deja.

HTH.
Alex.




More information about the Python-list mailing list