Multi-Line Comment

D

Doug Tolton

I've been using Python for quite some time now, and I'm a bit stumped.

Does it really not have a multi-line comment? I think I must just be
missing something simple and stupid.

Thanks in advance.

Doug Tolton
 
A

Aahz

Does it really not have a multi-line comment? I think I must just be
missing something simple and stupid.

'''
Most people use triple-quoted strings
for multi-line comments.
'''
 
D

Doug Tolton

Nope, no multi-line comment. The python-mode package which is available for
Emacs and XEmacs supports commenting a block of text. You can also use
triple-quoted strings:

How do you comment the block of text with Emacs? That is what I'm
using for my code editor.

I was wondering if a triple-quoted string not assigned would work, but
I hadn't got arround to trying it yet.

Doug Tolton
 
D

David Bolen

Doug Tolton said:
How do you comment the block of text with Emacs? That is what I'm
using for my code editor.

In Python mode, use C-c # to comment the selected region and C-u C-c #
to uncomment a region. The commenting is done with "##" at the front
of every line in the region, so it normally stands out from actual
comments due to the #-doubling.

-- David
 
J

John J. Lee

Doug Tolton said:
How do you comment the block of text with Emacs? That is what I'm
using for my code editor.

C-c #

I use C-x r k to uncomment (kill-rectangle), but I'm sure there must
be an uncomment-region in there somewhere...

I was wondering if a triple-quoted string not assigned would work, but
I hadn't got arround to trying it yet.

The only trouble with TCSs is that emacs gets confused more easily
than with '## ' multiline-comments. And recent CVS python-modes have
had broken docstring fill (still broken, actually, whitespace gets
collapsed sometimes... must file a bug).


John
 
I

Isaac To

John> C-c #

John> I use C-x r k to uncomment (kill-rectangle), but I'm sure there
John> must be an uncomment-region in there somewhere...

Just do C-u C-c #

Regards,
Isaac.
 
J

John J. Lee

Isaac To said:
[...]
John> I use C-x r k to uncomment (kill-rectangle), but I'm sure there
John> must be an uncomment-region in there somewhere...

Just do C-u C-c #

D'oh!


John
 
C

Christopher Blunck

Doug> I've been using Python for quite some time now, and I'm a bit
Doug> stumped. Does it really not have a multi-line comment? I think I
Doug> must just be missing something simple and stupid.

Nope, no multi-line comment. The python-mode package which is available for
Emacs and XEmacs supports commenting a block of text. You can also use
triple-quoted strings:

That always stumped me as well. Any idea what the justification for this
was, Skip?


-c
 
S

Sean 'Shaleh' Perry

That always stumped me as well. Any idea what the justification for this
was, Skip?

none of the other shell/script languages have one either. I rarely miss it.
 
D

Doug Tolton

(along with block indent/dedent with a decent editor)

In emacs what are the key strocks for block indent and dedent?

Man, I wonder if I'll even learn 10% of the Emacs keystrokes.

Doug Tolton
 
F

Francois Pinard

[Doug Tolton]
Man, I wonder if I'll even learn 10% of the Emacs keystrokes.

And then, you'll realise than pre-made keystrokes are only a small part
of all available commands. And then, you'll realise that all available
commands are only a small part of all available functions. And, of course,
all of the above is only a small drop in the ocean of possibilities given
by the capability of extending the editor with new functions. At times,
I wonder if this should be seen as comforting or frightening. :)
 
S

Skip Montanaro

Francois> At times, I wonder if this should be seen as comforting or
Francois> frightening. :)

Adventurous...

Skip
 
T

Tom Plunket

Chad said:
In python-mode:

C-c >
C-c <

Oh cool. I've been using C-x r o and C-x r k to open and kill
rectangles. Your way seems much easier. ;) Thanks. ;)

-tom!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top