Neil Hodgson wrote: > Hi Steven, > > It is *easy* to detect when a line is already commented. It starts with a > > #. The ~ is superfluous. > > It is not usual to change a line from being code to being a comment > as most lines of code make no sense as English text. If you do sometimes > want to do this, the "#" key can be pressed at the beginning of a line. > Ctrl+Q exists to allow commenting out sections of code that you do not > want to be active. The "~" acts to differentiate these different uses of > one language feature and makes it easy to apply the operation over > ranges that include comments and then invert the operation.
hi. 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. so let's say i mark and ^Q this: ------------------ code1 #comment1 #comment2 code2 ---------------- 1st line is not commented, so i want to comment-out the whole blcok, the result is ------------------ #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: ------------------ code1 #comment1 #comment2 code2 ---------------- so there is a way to do it without #~ noise... now if we can only think of how to do DWIM copy&paste :-)! - nas -- http://mail.python.org/mailman/listinfo/python-list