comment out more than 1 line at once?

Jerry Sievers jerry at
Tue Nov 30 15:04:58 CET 2004

Uwe Grauer <news at> writes:

> Riko,
> if you are using emacs, try C-c # to comment out a block of code.
> Unfortunally Uncomment is not bound to a key by default.
> Do a key-binding for it by yourself.

In Emacs, you can have the comment-region command do uncomment by
typing C-u first;

C-c #		comment region
C-u C-c #	uncomment region

>From the Emacs online help for plain comment-region'.  you are
probably invoking py-comment-region which is just a python tailored

	Comment or uncomment each line in the region.  With just C-u
	prefix arg, uncomment each line in region.  Numeric prefix arg
	ARG means use ARG comment characters.  If ARG is negative,
	delete that many comment characters instead.  Comments are
	terminated on each line, even for syntax in which newline does
	not end the comment.  Blank lines do not get comments.

...Curiosly, I tried the numeric prefix arg to see it use 2 or more
comment chars or delete as many and I get 2x the number of the prefix

C-u 2 C-c #		and I get;

####def foo():


Jerry Sievers   305 854-3001 (home)     WWW ECommerce Consultant
                305 321-1144 (mobile

More information about the Python-list mailing list