commenting out blocks of code

Peter Hansen peter at engcorp.com
Sun Feb 19 08:13:28 EST 2006


Steve Holden wrote:
> Steven D'Aprano wrote:
>>On Fri, 17 Feb 2006 19:12:01 -0500, Peter Hansen wrote:
>>>Scite, for example, lets me selected a block and hit Ctrl-Q to either 
>>>comment or uncomment the block.
>>>(It does this by prefixing each line 
>>>with #~ instead of just #, which allows it to detect when a line is 
>>>already so commented and reverse the operation.)  
>>
>>It is *easy* to detect when a line is already commented. It starts with a
>>#. The ~ is superfluous.
>>
>>Commenting and uncommenting should be two different commands: the whole
>>point of nested comments is that it allows you to comment a block of text
>>which may already contain comments. Having one command do both commenting
>>and uncommenting according to the presence or absence of semantic clues in
>>the text is a recipe for failure ("No you stupid computer, I want to
>>COMMENT that block, not uncomment it!!!").
>>
>>Imagine if your text editor used cntl-C for both copy and paste, somehow
>>guessing whether you wanted to copy selected text or paste over it
>>according to some subtle clue in the text itself. Wouldn't that be fun?
> 
> I agree that's a less-than-sensible feature implementation.

I submit that Steve and Steven (neither of whom has apparently even 
*used* this feature of Scite before criticizing it so strongly), should 
consider whether in actual practice something like this might not be 
much more effective than they can apparently imagine.

I'm strongly critical of many features of most editors, and thus use 
very few of them, and I also happen to have a solid background in GUI 
design and ergonomics.  I'm also a heavy user of Scite, and have found 
it readily accepted amongst the groups of programmers with whom I've worked.

I and my team have found the Ctrl+Q feature of Scite to be very 
sensible, highly effective and useful, and in fact *better* than 
alternatives that we've used before in other editors.

Kudos to Neil for having the (apparently) unusual design sense to think 
of it and implement it!

So there.  Harumph.  :-)

-Peter




More information about the Python-list mailing list