if(debug), optimized away?

M marvelan at hotmail.com
Thu Jul 25 14:04:21 EDT 2002


I would like to use something like this when running in
debug mode:

if(debug):
   if(items > 9):
     print "fatal error..." 
   do_some_check_foo(42)
   ...


If I set debug=0, is this code optimized away as in most
C/C++?? compilers?

The reason for asking is that I would like to have A LOT of
debugging code and would like to avoid the performance penalty
when not runing in debug mode.

Are there other, perhaps more Pythonish, ways of doing the same
thing?

/M



More information about the Python-list mailing list