commenting out blocks of code

Neil Hodgson nyamatongwe+thunder at gmail.com
Sun Feb 19 19:42:09 EST 2006


Atanas Banov:

> here is something you both seems to have not considered: imagine you
> make decision if ^Q has to comment or uncomment based on the 1st line
> and not on each line individually in the block. 

   When first implementing Ctrl+Q, this looked to have similar
advantages and disadvantages to the chosen implementation. However, it
wouldn't allow a technique I've come to use which is to have two
versions of some code or section of a configuration file and to toggle
between the two by selecting the whole range and pressing Ctrl+Q.

> #code1
> ##comment1
> ##comment2
> #code2
> ----------------
> 
> note how ## maintains where comments were. now, for the same selection,
> ^Q again? 1st character is #, so the editor is asked to uncomment,
> dwim:

   The problem with "##" as opposed to "#~" is that "##" is common in
much source code particularly in barrier comments and comment sections:

############ Persistence section ############
## These functions are responsible for load
## and save for the core media database.

   Neil



More information about the Python-list mailing list