comment out more than 1 line at once?
Gustavo Córdova Avila
gustavo.cordova at q-voz.com
Tue Nov 30 13:24:22 EST 2004
Rob Williscroft wrote:
>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.
>
Actually, it's infinitly [sp?] more defficient
(contrary of efficient?) than triple-quoted strings
or line-by-line comments, because those two never
make it to execution stage, because they're dropped
by the compiler. :-)
--
Gustavo Córdova Avila <gustavo.cordova at q-voz.com>
<mailto:gustavo.cordova at q-voz.com>
*Tel:* +52 (81) 8130-1919 ext. 127
Integraciones del Norte, S.A. de C.V.
Padua #6047, Colonia Satélite Acueducto
Monterrey, Nuevo León, México.
More information about the Python-list
mailing list