preprocessor for Python?

alex alex at
Wed Nov 24 23:51:36 EST 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

if __debug__:

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


More information about the Python-list mailing list