comment out more than 1 line at once?

Rob Williscroft rtw at freenet.co.uk
Tue Nov 30 12:47:55 EST 2004


Riko Wichmann wrote in news:cohc71$2pqli$1 at claire.desy.de in 
comp.lang.python:

> Dear all,
> 
> is there a way in Python to comment out blocks of code without putting a 
> # in front of each line? Somethings like C's
> 
> /*
>      block of code here is commented out
> */
> 

if False:

  (indented) block of code here is commented out

I've no idea how efficient it is compared to triple-quoted strings
or line by line comments. But (at least with the editors I use) it
does retain the syntax highlighting, which I quite like YMMV.

BTW for C and C++:

#if 0

 block of code here is commented out
 /* with embeded comments ! */

#endif

Rob.
-- 
http://www.victim-prime.dsl.pipex.com/



More information about the Python-list mailing list