Conditional compilation

Martin v. Löwis loewis at informatik.hu-berlin.de
Fri May 10 09:13:14 EDT 2002


jb <jblazi at hotmail.com> writes:

> This question was probably asked many times.
> 
> It does not seem to be possible to "comment out" blocks of code, which would 
> be a very nice feature for testing purposes. (Maybe I can do it with """ 
> but that looks a bit cumbersome.)
> 
> Any ideas, hint, proposals?

The typical solution is to put the entire block in a "if 0:"
statement.  If your editor does not conveniently allow to right-indent
a block of code, you may succeed with putting the if statement on the
half indentation level; you'll need to add 'if 1:' for the rest of the
block in this case, also.

HTH,
Martin




More information about the Python-list mailing list