Indentation question

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • David Lees

    Indentation question

    I have a real basic how-to question. When I decide to reuse a piece of
    python code at a different indentation level than the original, is there
    a common trick (or set of tricks) for moving the indentation correctly
    for the whole block? Probably this is editor dependent, so if some has
    a FAQ or pointer to a page please feel free to post. Typical I use
    PythonWin as my editor, though sometimes I use EditPadLite (an ascii
    editor).

    TIA

    David Lees

  • Christos TZOTZIOY Georgiou

    #2
    Re: Indentation question

    On Sat, 23 Aug 2003 05:50:25 GMT, rumours say that Geoff Howland
    <ghowland@lupin eNO.SPAMgames.c om> might have written:

    [David Lees asks how to indent and unindent a group of lines in his
    code, referring to PythonWin and EditPadLight]
    [color=blue]
    >A lot of editors use the method of:
    >
    >1. Select lines of text
    >2. Press TAB or SHIFT+TAB to change indentation out or in
    >respectively .[/color]
    [color=blue]
    >I dont know about those editors though.[/color]

    This works for PythonWin, I don't know for EditPadLite. In IDLE (in
    windows at least), the keypresses are ^[ and ^] for unindenting and
    indenting, respectively; check the Edit menu for the actual shortcuts.
    --
    TZOTZIOY, I speak England very best,
    Microsoft Security Alert: the Matrix began as open source.

    Comment

    • Christos TZOTZIOY Georgiou

      #3
      Re: Indentation question

      On Sat, 23 Aug 2003 05:50:25 GMT, rumours say that Geoff Howland
      <ghowland@lupin eNO.SPAMgames.c om> might have written:

      [David Lees asks how to indent and unindent a group of lines in his
      code, referring to PythonWin and EditPadLight]
      [color=blue]
      >A lot of editors use the method of:
      >
      >1. Select lines of text
      >2. Press TAB or SHIFT+TAB to change indentation out or in
      >respectively .[/color]
      [color=blue]
      >I dont know about those editors though.[/color]

      This works for PythonWin, I don't know for EditPadLite. In IDLE (in
      windows at least), the keypresses are ^[ and ^] for unindenting and
      indenting, respectively; check the Edit menu for the actual shortcuts.
      --
      TZOTZIOY, I speak England very best,
      Microsoft Security Alert: the Matrix began as open source.

      Comment

      • David Lees

        #4
        Re: Indentation question

        Christos TZOTZIOY Georgiou wrote:[color=blue]
        > On Sat, 23 Aug 2003 05:50:25 GMT, rumours say that Geoff Howland
        > <ghowland@lupin eNO.SPAMgames.c om> might have written:
        >
        > [David Lees asks how to indent and unindent a group of lines in his
        > code, referring to PythonWin and EditPadLight]
        >
        >[color=green]
        >>A lot of editors use the method of:
        >>
        >>1. Select lines of text
        >>2. Press TAB or SHIFT+TAB to change indentation out or in
        >>respectivel y.[/color]
        >
        >[color=green]
        >>I dont know about those editors though.[/color]
        >
        >
        > This works for PythonWin, I don't know for EditPadLite. In IDLE (in
        > windows at least), the keypresses are ^[ and ^] for unindenting and
        > indenting, respectively; check the Edit menu for the actual shortcuts.[/color]

        I just tried it in EditPad and PythonWin. It works in both. Thanks
        guys, this is real handy to know.

        David Lees

        Comment

        • Anand Pillai

          #5
          Re: Indentation question

          I can suggest two editors which does the block indentation.

          1. IDLE
          2. GNU Emacs

          In IDLE AFAIK, this option is available as "Dedent Region"
          to indent the code-block lesser, and "Indent Region" to indent
          it more, i.e to the right.

          In GNU Emacs, you can mark the region you want to indent/dedent,
          go to the Editor menu and say, "Indent Right More", "Indent Left More",
          etc which respectively indents the code-block more to the right
          and more to the left.

          -Anand

          David Lees <abcdebl2nonspa [email protected] > wrote in message news:<1aV1b.919 0$vy5.3133@nwrd dc01.gnilink.ne t>...[color=blue]
          > Christos TZOTZIOY Georgiou wrote:[color=green]
          > > On Sat, 23 Aug 2003 05:50:25 GMT, rumours say that Geoff Howland
          > > <ghowland@lupin eNO.SPAMgames.c om> might have written:
          > >
          > > [David Lees asks how to indent and unindent a group of lines in his
          > > code, referring to PythonWin and EditPadLight]
          > >
          > >[color=darkred]
          > >>A lot of editors use the method of:
          > >>
          > >>1. Select lines of text
          > >>2. Press TAB or SHIFT+TAB to change indentation out or in
          > >>respectivel y.[/color]
          > >
          > >[color=darkred]
          > >>I dont know about those editors though.[/color]
          > >
          > >
          > > This works for PythonWin, I don't know for EditPadLite. In IDLE (in
          > > windows at least), the keypresses are ^[ and ^] for unindenting and
          > > indenting, respectively; check the Edit menu for the actual shortcuts.[/color]
          >
          > I just tried it in EditPad and PythonWin. It works in both. Thanks
          > guys, this is real handy to know.
          >
          > David Lees[/color]

          Comment

          • JanC

            #6
            Re: Indentation question

            Christos "TZOTZIOY" Georgiou <[email protected]> schreef:
            [color=blue][color=green]
            >>A lot of editors use the method of:
            >>
            >>1. Select lines of text
            >>2. Press TAB or SHIFT+TAB to change indentation out or in
            >>respectivel y.[/color]
            >[color=green]
            >>I dont know about those editors though.[/color]
            >
            > This works for PythonWin[/color]

            AFAIK PythonWin uses the Scintilla editor component?

            This should (could?) work with all other Scintilla-based editors too:
            SciTE, pyCrust, Eric3, Wing IDE, Boa Constructor, Black Adder, etc.

            --
            JanC

            "Be strict when sending and tolerant when receiving."
            RFC 1958 - Architectural Principles of the Internet - section 3.9

            Comment

            • Neil Hodgson

              #7
              Re: Indentation question

              JanC:
              [color=blue]
              > AFAIK PythonWin uses the Scintilla editor component?[/color]

              Yes.
              [color=blue]
              > This should (could?) work with all other Scintilla-based editors too:
              > SciTE, pyCrust, Eric3, Wing IDE, Boa Constructor, Black Adder, etc.[/color]

              This will work by default in Scintilla based editors. The container may
              override the key binding which may happen when they emulate another editor
              such as EMACS.

              Neil


              Comment

              Working...