Multi-Line Comment

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Doug Tolton

    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
  • Aahz

    #2
    Re: Multi-Line Comment

    In article <4qofjvg3bh9sml nb1do4f0lhjga7b acnu3@4ax.com>,
    Doug Tolton <dtolton@yahoo. com> wrote:[color=blue]
    >
    >Does it really not have a multi-line comment? I think I must just be
    >missing something simple and stupid.[/color]

    '''
    Most people use triple-quoted strings
    for multi-line comments.
    '''
    --
    Aahz (aahz@pythoncra ft.com) <*> http://www.pythoncraft.com/

    This is Python. We don't care much about theory, except where it intersects
    with useful practice. --Aahz

    Comment

    • Doug Tolton

      #3
      Re: Multi-Line Comment

      On Mon, 11 Aug 2003 14:17:38 -0500, Skip Montanaro <skip@pobox.com >
      wrote:

      [color=blue]
      >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:
      >[/color]

      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

      Comment

      • David Bolen

        #4
        Re: Multi-Line Comment

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

        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

        Comment

        • John J. Lee

          #5
          Re: Multi-Line Comment

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

          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...

          [color=blue]
          > I was wondering if a triple-quoted string not assigned would work, but
          > I hadn't got arround to trying it yet.[/color]

          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

          Comment

          • Isaac To

            #6
            Re: Multi-Line Comment

            >>>>> "John" == John J Lee <jjl@pobox.co m> writes:

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

            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.

            Comment

            • John J. Lee

              #7
              Re: Multi-Line Comment

              Isaac To <kkto@csis.hku. hk> writes:
              [color=blue][color=green][color=darkred]
              > >>>>> "John" == John J Lee <jjl@pobox.co m> writes:[/color][/color][/color]
              [...][color=blue]
              > 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 #[/color]

              D'oh!


              John

              Comment

              • Christopher Blunck

                #8
                Re: Multi-Line Comment

                On Mon, 11 Aug 2003 14:17:38 -0500, Skip Montanaro wrote:
                [color=blue]
                >
                > 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:[/color]

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


                -c

                Comment

                • Sean 'Shaleh' Perry

                  #9
                  Re: Multi-Line Comment

                  On Tuesday 12 August 2003 22:07, Christopher Blunck wrote:[color=blue][color=green]
                  > >
                  > > 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:[/color]
                  >
                  > That always stumped me as well. Any idea what the justification for this
                  > was, Skip?
                  >[/color]

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


                  Comment

                  • Doug Tolton

                    #10
                    Re: Multi-Line Comment

                    On Tue, 12 Aug 2003 23:21:16 -0700, Chad Netzer <cnetzer@sonic. net>
                    wrote:
                    [color=blue]
                    >(along with block indent/dedent with a decent editor)[/color]

                    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

                    Comment

                    • Chad Netzer

                      #11
                      Re: Multi-Line Comment

                      On Wed, 2003-08-13 at 00:03, Doug Tolton wrote:
                      [color=blue][color=green]
                      > >(along with block indent/dedent with a decent editor)[/color]
                      >
                      > In emacs what are the key strocks for block indent and dedent?[/color]

                      In python-mode:

                      C-c >
                      C-c <

                      [color=blue]
                      > Man, I wonder if I'll even learn 10% of the Emacs keystrokes.[/color]

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

                      --
                      Chad Netzer


                      Comment

                      • Neil Padgen

                        #12
                        Re: Multi-Line Comment

                        On Wednesday 13 August 2003 07:03, Doug Tolton wrote:[color=blue]
                        > Man, I wonder if I'll even learn 10% of the Emacs keystrokes.[/color]

                        From inside an Emacs python buffer, do

                        M-x py-describe-mode

                        -- Neil

                        Comment

                        • Francois Pinard

                          #13
                          Emacs [was: Re: Multi-Line Comment]

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

                          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

                          Comment

                          • Skip Montanaro

                            #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

                            Comment

                            • Tom Plunket

                              #15
                              Re: Multi-Line Comment

                              Chad Netzer wrote:
                              [color=blue][color=green]
                              > > In emacs what are the key strocks for block indent and dedent?[/color]
                              >
                              > In python-mode:
                              >
                              > C-c >
                              > C-c <[/color]

                              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.

                              Comment

                              Working...