auto indent

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • M.N.Smadi

    #1

    auto indent

    Hi there;

    i have a script that is not indented properly. Is there a way that i can
    have it auto indented.

    thanks
    moe smadi
  • Larry Bates

    #2
    Re: auto indent

    M.N.Smadi wrote:
    Hi there;
    >
    i have a script that is not indented properly. Is there a way that i can
    have it auto indented.
    >
    thanks
    moe smadi
    Not really. Indention in python conveys blocks so there is no way
    anything automatic could determine where blocks end. Its just like
    asking if you could have something automatically insert parenthesis
    everywhere they are needed.

    -Larry

    Comment

    • Larry Bates

      #3
      Re: auto indent

      M.N.Smadi wrote:
      Hi there;
      >
      i have a script that is not indented properly. Is there a way that i can
      have it auto indented.
      >
      thanks
      moe smadi
      Not really. Indention in python conveys blocks so there is no way
      anything automatic could determine where blocks end. Its just like
      asking if you could have something automatically insert parenthesis
      everywhere they are needed.

      -Larry

      Comment

      • John Henry

        #4
        Re: auto indent


        M.N.Smadi wrote:
        Hi there;
        >
        i have a script that is not indented properly. Is there a way that i can
        have it auto indented.
        >
        thanks
        moe smadi
        It depends what exactly you mean. I use Textpad and they have an
        "indent selected block" feature.

        Comment

        • John Machin

          #5
          Re: auto indent

          M.N.Smadi wrote:
          Hi there;
          >
          i have a script that is not indented properly. Is there a way that i can
          have it auto indented.
          It depends on what you mean by "not indented properly". Indentation is
          part of the Python grammar.

          If the script compiles OK, and works as expected, but you have (say)
          4-space indent in parts, and 3-space in other parts, or a mixture of
          tabs and spaces, you could use the supplied reindent script. It's
          C:\Python25\Too ls\Scripts\rein dent.py on my machine. Do read the
          documentation at the start of the script before you run it.

          If you mean that the indentation is just plain wrong, such that the
          script will not compile without error, or incorrect indentation of one
          or more lines is causing incorrect results, then you will have to fix
          it manually. There is no "artificial intelligence" that can work out
          what the indentation should be.

          HTH,
          John

          Comment

          • jussij@zeusedit.com

            #6
            Re: auto indent

            M.N.Smadi wrote:
            i have a script that is not indented properly. Is there
            a way that i can have it auto indented.
            FWIW the Zeus for Windows IDE will fold Pyhon code:

            A powerful, feature packed, fully configurable IDE specifically designed for Windows developers....


            With the code folded you can then select the folded line and
            using 'tab'/'shift tab' Zeus will indent/re-indent all the
            lines contained in the fold.

            It is not an automatic re-indenting solution but it might be
            better than nothing ;)

            Jussi Jumppanen
            Author: Zeus for Windows IDE

            Comment

            Working...