472,791 Members | 1,729 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,791 software developers and data experts.

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 91622
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

37
by: ajikoe | last post by:
Hello, Is anyone has experiance in running python code to run multi thread parallel in multi processor. Is it possible ? Can python manage which cpu shoud do every thread? Sincerely Yours,...
4
by: Frank Jona | last post by:
Intellisense with C# and a multi-file assembly is not working. With VB.NET it is working. Is there a fix availible? We're using VisualStudio 2003 Regards Frank
12
by: * ProteanThread * | last post by:
but depends upon the clique: ...
0
by: frankenberry | last post by:
I have multi-page tiff files. I need to extract individual frames from the multi-page tiffs and save them as single-page tiffs. 95% of the time I receive multi-page tiffs containing 1 or more black...
6
by: cody | last post by:
What are multi file assemblies good for? What are the advantages of using multiple assemblies (A.DLL+B.DLL) vs. a single multi file assembly (A.DLL+A.NETMODULE)?
6
by: Joe | last post by:
I have 2 multi-list boxes, 1 displays course categories based on a table called CATEGORIES. This table has 2 fields CATEGORY_ID, CATEGORY_NAME The other multi-list box displays courses based on...
4
by: mimmo | last post by:
Hi! I should convert the accented letters of a string in the correspondent letters not accented. But when I compile with -Wall it give me: warning: multi-character character constant Do the...
5
by: Shane Story | last post by:
I can seem to get the dimensions of a frame in a multiframe tiff. After selecting activeframe, the Width/Height is still really much larger than the page's actual dimensions. When I split a...
5
by: bobwansink | last post by:
Hi, I'm relatively new to programming and I would like to create a C++ multi user program. It's for a project for school. This means I will have to write a paper about the theory too. Does anyone...
0
by: Sabri.Pllana | last post by:
We apologize if you receive multiple copies of this call for papers. *********************************************************************** 2008 International Workshop on Multi-Core Computing...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: lllomh | last post by:
How does React native implement an English player?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.