Multi-Line Comment

Discussion in 'Python' started by Doug Tolton, Aug 11, 2003.

  1. Doug Tolton

    Doug Tolton Guest

    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
     
    Doug Tolton, Aug 11, 2003
    #1
    1. Advertising

  2. Doug Tolton

    Aahz Guest

    In article <>,
    Doug Tolton <> 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 () <*> http://www.pythoncraft.com/

    This is Python. We don't care much about theory, except where it intersects
    with useful practice. --Aahz
     
    Aahz, Aug 11, 2003
    #2
    1. Advertising

  3. Doug Tolton

    Doug Tolton Guest

    On Mon, 11 Aug 2003 14:17:38 -0500, Skip Montanaro <>
    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
     
    Doug Tolton, Aug 11, 2003
    #3
  4. Doug Tolton

    David Bolen Guest

    Doug Tolton <> 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
     
    David Bolen, Aug 11, 2003
    #4
  5. Doug Tolton

    John J. Lee Guest

    Doug Tolton <> 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
     
    John J. Lee, Aug 12, 2003
    #5
  6. Doug Tolton

    Isaac To Guest

    >>>>> "John" == John J Lee <> writes:

    John> Doug Tolton <> 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.
     
    Isaac To, Aug 12, 2003
    #6
  7. Doug Tolton

    John J. Lee Guest

    Isaac To <> writes:

    > >>>>> "John" == John J Lee <> 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
     
    John J. Lee, Aug 12, 2003
    #7
  8. 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
     
    Christopher Blunck, Aug 13, 2003
    #8
  9. 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.
     
    Sean 'Shaleh' Perry, Aug 13, 2003
    #9
  10. Doug Tolton

    Doug Tolton Guest

    On Tue, 12 Aug 2003 23:21:16 -0700, Chad Netzer <>
    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
     
    Doug Tolton, Aug 13, 2003
    #10
  11. Doug Tolton

    Chad Netzer Guest

    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
     
    Chad Netzer, Aug 13, 2003
    #11
  12. Doug Tolton

    Neil Padgen Guest

    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
     
    Neil Padgen, Aug 13, 2003
    #12
  13. Emacs [was: Re: Multi-Line Comment]

    [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
     
    Francois Pinard, Aug 13, 2003
    #13
  14. Re: Emacs [was: Re: Multi-Line Comment]

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

    Adventurous...

    Skip
     
    Skip Montanaro, Aug 13, 2003
    #14
  15. Doug Tolton

    Tom Plunket Guest

    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.
     
    Tom Plunket, Aug 13, 2003
    #15
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Alec S.
    Replies:
    10
    Views:
    10,262
    Alec S.
    Apr 16, 2005
  2. Tim Peters

    RE: Multi-Line Comment

    Tim Peters, Aug 11, 2003, in forum: Python
    Replies:
    0
    Views:
    369
    Tim Peters
    Aug 11, 2003
  3. dean
    Replies:
    5
    Views:
    489
    Phlip
    Jun 4, 2006
  4. bernadou

    Force multi line field value to output with line breaks?

    bernadou, Jan 22, 2006, in forum: ASP .Net Web Controls
    Replies:
    2
    Views:
    379
    bernadou
    Jan 23, 2006
  5. Anthony Papillion
    Replies:
    0
    Views:
    137
    Anthony Papillion
    Sep 2, 2013
Loading...

Share This Page