468,267 Members | 1,960 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,267 developers. It's quick & easy.

Multi-Line Comment

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
Jul 18 '05 #1
14 91298
In article <4q********************************@4ax.com>,
Doug Tolton <dt*****@yahoo.com> wrote:

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.
'''
--
Aahz (aa**@pythoncraft.com) <*> http://www.pythoncraft.com/

This is Python. We don't care much about theory, except where it intersects
with useful practice. --Aahz
Jul 18 '05 #2
On Mon, 11 Aug 2003 14:17:38 -0500, Skip Montanaro <sk**@pobox.com>
wrote:

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
Jul 18 '05 #3
Doug Tolton <dt*****@yahoo.com> writes:
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
Jul 18 '05 #4
Doug Tolton <dt*****@yahoo.com> writes:
[...]
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
Jul 18 '05 #5
>>>>> "John" == John J Lee <jj*@pobox.com> writes:

John> Doug Tolton <dt*****@yahoo.com> writes: [...]
How do you comment the block of text with Emacs? That is what I'm
using for my code editor.


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.
Jul 18 '05 #6
Isaac To <kk**@csis.hku.hk> writes:
>> "John" == John J Lee <jj*@pobox.com> writes:
[...] 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
Jul 18 '05 #7
On Mon, 11 Aug 2003 14:17:38 -0500, Skip Montanaro wrote:

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

Jul 18 '05 #8
On Tuesday 12 August 2003 22:07, Christopher Blunck wrote:

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?


none of the other shell/script languages have one either. I rarely miss it.
Jul 18 '05 #9
On Tue, 12 Aug 2003 23:21:16 -0700, Chad Netzer <cn*****@sonic.net>
wrote:
(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
Jul 18 '05 #10
On Wed, 2003-08-13 at 00:03, Doug Tolton wrote:
(along with block indent/dedent with a decent editor)
In emacs what are the key strocks for block indent and dedent?


In python-mode:

C-c >
C-c <

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


I don't even know 1%, but I know the 1% that counts. :)

--
Chad Netzer
Jul 18 '05 #11
On Wednesday 13 August 2003 07:03, Doug Tolton wrote:
Man, I wonder if I'll even learn 10% of the Emacs keystrokes.


From inside an Emacs python buffer, do

M-x py-describe-mode

-- Neil

Jul 18 '05 #12
[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. :-)

--
François Pinard http://www.iro.umontreal.ca/~pinard

Jul 18 '05 #13

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

Adventurous...

Skip

Jul 18 '05 #14
Chad Netzer wrote:
In emacs what are the key strocks for block indent and dedent?


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!

--
There's really no reason to send a copy of your
followup to my email address, so please don't.
Jul 18 '05 #15

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

37 posts views Thread by ajikoe | last post: by
4 posts views Thread by Frank Jona | last post: by
5 posts views Thread by bobwansink | last post: by
reply views Thread by NPC403 | last post: by
reply views Thread by kermitthefrogpy | last post: by
reply views Thread by zattat | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.