help: code formatter?

Discussion in 'Python' started by siggi, Jan 8, 2007.

  1. siggi

    siggi Guest

    Hi all,

    as a newbie I have problems with formatting code of downloaded programs,
    because IDLE's reformatting capabilities are limited . Incorrect
    indentation, mixing of TAB with BLANKs or eol are often very nasty to
    correct.
    Is there a simple code formatter that first removes all indentations and
    then refomats correctly?

    Please help!

    Thank you,

    siggi
    siggi, Jan 8, 2007
    #1
    1. Advertising

  2. siggi wrote:

    > as a newbie I have problems with formatting code of downloaded
    > programs, because IDLE's reformatting capabilities are limited .
    > Incorrect indentation, mixing of TAB with BLANKs or eol are often
    > very nasty to correct.
    > Is there a simple code formatter that first removes all
    > indentations and then refomats correctly?


    Why don't you just write one? :)

    Seriously: Try.

    BTW: Guessing to what amount of space TABs must be converted in
    mixed source can be non-trivial.

    Regards,


    Björn

    --
    BOFH excuse #289:

    Interference between the keyboard and the chair.
    Bjoern Schliessmann, Jan 8, 2007
    #2
    1. Advertising

  3. siggi schrieb:
    > Hi all,
    >
    > as a newbie I have problems with formatting code of downloaded programs,
    > because IDLE's reformatting capabilities are limited . Incorrect
    > indentation, mixing of TAB with BLANKs or eol are often very nasty to
    > correct.
    > Is there a simple code formatter that first removes all indentations and
    > then refomats correctly?
    >
    > Please help!



    Tools\scripts\reindent.py in your Python distribution.

    Thomas
    Thomas Heller, Jan 8, 2007
    #3
  4. siggi

    Chuck Rhode Guest

    siggi wrote this on Mon, Jan 08, 2007 at 03:33:21PM +0100. My reply is below.

    > Is there a simple code formatter that first removes all indentations
    > and then refomats correctly?


    Why, yes, there is:

    http://lacusveris.com/PythonTidy/PythonTidy.python

    --
    ... Chuck Rhode, Sheboygan, WI, USA
    ... 1979 Honda Goldwing GL1000 (Geraldine)
    ... Weather: http://LacusVeris.com/WX
    ... 26° — Wind W 17 mph
    Chuck Rhode, Jan 8, 2007
    #4
  5. siggi

    siggi Guest

    Bjoern wrote:

    > Why don't you just write one? :)


    Very funny! Just learning Python :(

    Regards,

    siggi

    > siggi wrote:
    >
    >> as a newbie I have problems with formatting code of downloaded
    >> programs, because IDLE's reformatting capabilities are limited .
    >> Incorrect indentation, mixing of TAB with BLANKs or eol are often
    >> very nasty to correct.
    >> Is there a simple code formatter that first removes all
    >> indentations and then refomats correctly?

    >
    > Why don't you just write one? :)
    >
    > Seriously: Try.
    >
    > BTW: Guessing to what amount of space TABs must be converted in
    > mixed source can be non-trivial.
    >
    > Regards,
    >
    >
    > Björn
    >
    > --
    > BOFH excuse #289:
    >
    > Interference between the keyboard and the chair.
    >
    siggi, Jan 9, 2007
    #5
  6. siggi

    siggi Guest

    Chuck wrote:

    > http://lacusveris.com/PythonTidy/PythonTidy.python


    Wow, what a giant of a program! Trying to find out how this works.

    Thank you,

    siggi

    "Chuck Rhode" <> schrieb im Newsbeitrag
    news:...
    > siggi wrote this on Mon, Jan 08, 2007 at 03:33:21PM +0100. My reply is
    > below.
    >
    >> Is there a simple code formatter that first removes all indentations
    >> and then refomats correctly?

    >
    > Why, yes, there is:
    >
    > http://lacusveris.com/PythonTidy/PythonTidy.python
    >
    > --
    > .. Chuck Rhode, Sheboygan, WI, USA
    > .. 1979 Honda Goldwing GL1000 (Geraldine)
    > .. Weather: http://LacusVeris.com/WX
    > .. 26° - Wind W 17 mph
    >
    siggi, Jan 9, 2007
    #6
  7. siggi

    siggi Guest

    Thomas wrote:

    > Tools\scripts\reindent.py in your Python distribution.


    Thank you Thomas!

    What a bucket full of toolsin \tools! I didn't know that.

    siggi


    "Thomas Heller" <> schrieb im Newsbeitrag
    news:...
    > siggi schrieb:
    >> Hi all,
    >>
    >> as a newbie I have problems with formatting code of downloaded programs,
    >> because IDLE's reformatting capabilities are limited . Incorrect
    >> indentation, mixing of TAB with BLANKs or eol are often very nasty to
    >> correct.
    >> Is there a simple code formatter that first removes all indentations and
    >> then refomats correctly?
    >>
    >> Please help!

    >
    >
    > Tools\scripts\reindent.py in your Python distribution.
    >
    > Thomas
    siggi, Jan 9, 2007
    #7
  8. Re: code formatter?

    "siggi" <> wrote:

    > Is there a simple code formatter that first removes all indentations and
    > then refomats correctly?


    tabnanny ?

    - Hendrik
    Hendrik van Rooyen, Jan 9, 2007
    #8
  9. siggi

    siggi Guest

    Re: code formatter?

    >tabnanny?
    not quite!

    "Hendrik van Rooyen" <> schrieb im Newsbeitrag
    news:...
    > "siggi" <> wrote:
    >
    >> Is there a simple code formatter that first removes all indentations and
    >> then refomats correctly?

    >
    > tabnanny ?
    >
    > - Hendrik
    >
    >
    >
    siggi, Jan 9, 2007
    #9
  10. siggi wrote:
    > Bjoern wrote:


    >> Why don't you just write one? :)

    >
    > Very funny! Just learning Python :(


    It isn't funny at all. You'll learn by doing and trying things.
    That's how all programmers start.

    Regards,


    Björn

    --
    BOFH excuse #265:

    The mouse escaped.
    Bjoern Schliessmann, Jan 9, 2007
    #10
    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. =?iso-8859-1?B?bW9vcJk=?=

    Configurable formatter for different source code

    =?iso-8859-1?B?bW9vcJk=?=, Jan 4, 2006, in forum: Java
    Replies:
    0
    Views:
    355
    =?iso-8859-1?B?bW9vcJk=?=
    Jan 4, 2006
  2. Replies:
    2
    Views:
    3,363
  3. Surendra Singhi

    Source code formatter?

    Surendra Singhi, Nov 17, 2005, in forum: C++
    Replies:
    8
    Views:
    857
    Ira Baxter
    Nov 27, 2005
  4. A.M-SG

    Switching from XML formatter to Binary Formatter

    A.M-SG, Nov 21, 2005, in forum: ASP .Net Web Services
    Replies:
    1
    Views:
    322
    Steven Cheng[MSFT]
    Nov 22, 2005
  5. Peter Fitzgibbons

    Jedit code formatter?

    Peter Fitzgibbons, Aug 2, 2005, in forum: Ruby
    Replies:
    2
    Views:
    155
    Belorion
    Aug 2, 2005
Loading...

Share This Page