Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old November 6th, 2006, 08:05 PM
M.N.Smadi
Guest
 
Posts: n/a
Default 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
  #2  
Old November 6th, 2006, 09:45 PM
Larry Bates
Guest
 
Posts: n/a
Default Re: auto indent

M.N.Smadi wrote:
Quote:
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
  #3  
Old November 6th, 2006, 09:45 PM
Larry Bates
Guest
 
Posts: n/a
Default Re: auto indent

M.N.Smadi wrote:
Quote:
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

  #4  
Old November 6th, 2006, 11:55 PM
John Henry
Guest
 
Posts: n/a
Default Re: auto indent


M.N.Smadi wrote:
Quote:
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.

  #5  
Old November 7th, 2006, 12:25 AM
John Machin
Guest
 
Posts: n/a
Default Re: auto indent

M.N.Smadi wrote:
Quote:
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\Tools\Scripts\reindent.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

  #6  
Old November 9th, 2006, 02:45 AM
jussij@zeusedit.com
Guest
 
Posts: n/a
Default Re: auto indent

M.N.Smadi wrote:
Quote:
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:

http://www.zeusedit.com/features.html

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

 

Bookmarks

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 Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles