Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > help: code formatter?

Reply
Thread Tools

help: code formatter?

 
 
siggi
Guest
Posts: n/a
 
      01-08-2007
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




 
Reply With Quote
 
 
 
 
Bjoern Schliessmann
Guest
Posts: n/a
 
      01-08-2007
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.

 
Reply With Quote
 
 
 
 
Thomas Heller
Guest
Posts: n/a
 
      01-08-2007
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
 
Reply With Quote
 
Chuck Rhode
Guest
Posts: n/a
 
      01-08-2007
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

 
Reply With Quote
 
siggi
Guest
Posts: n/a
 
      01-09-2007
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.
>



 
Reply With Quote
 
siggi
Guest
Posts: n/a
 
      01-09-2007
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" <(E-Mail Removed)> schrieb im Newsbeitrag
news:(E-Mail Removed)...
> 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
>



 
Reply With Quote
 
siggi
Guest
Posts: n/a
 
      01-09-2007
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" <(E-Mail Removed)> schrieb im Newsbeitrag
news:(E-Mail Removed)...
> 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



 
Reply With Quote
 
Hendrik van Rooyen
Guest
Posts: n/a
 
      01-09-2007
"siggi" <(E-Mail Removed)> wrote:

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


tabnanny ?

- Hendrik



 
Reply With Quote
 
siggi
Guest
Posts: n/a
 
      01-09-2007
>tabnanny?
not quite!

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

>
> tabnanny ?
>
> - Hendrik
>
>
>



 
Reply With Quote
 
Bjoern Schliessmann
Guest
Posts: n/a
 
      01-09-2007
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.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
what is the difference between code inside a <script> tag and code in the code-behind file? keithb ASP .Net 1 03-29-2006 01:00 AM
Fire Code behind code AND Javascript code associated to a Button Click Event =?Utf-8?B?Q2FybG8gTWFyY2hlc29uaQ==?= ASP .Net 4 02-11-2004 07:31 AM
Re: Code Behind vs. no code behind: error Ben Miller [msft] ASP .Net 1 06-28-2003 01:46 AM
Re: C# Equivalent of VB.Net Code -- One line of code, simple Ian ASP .Net 0 06-25-2003 01:14 PM
Re: C# Equivalent of VB.Net Code -- One line of code, simple Ron ASP .Net 1 06-24-2003 07:18 PM



Advertisments