473,324 Members | 2,268 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

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
Nov 6 '06 #1
5 1964
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
Nov 6 '06 #2
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

Nov 6 '06 #3

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.

Nov 6 '06 #4
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\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

Nov 7 '06 #5
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:

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

Nov 9 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: John Wellesz | last post by:
If you are coding php using GVIM, you will appreciate this new indent script: Download there: http://www.vim.org/scripts/download_script.php?src_id=3710 or here: ...
4
by: Alex Bell | last post by:
I am developing at http://www.members.iinet.net.au/~abell1/test/index.htm with city.css at http://www.members.iinet.net.au/~abell1/test/city.css. Both validate. In index.htm there is a block of...
6
by: Harlan Messinger | last post by:
A publication style guide indicates that for a table heading like the following, Table 3. Wheat and rye harvest in European countries in years that end in 3 or 7 or when a new prime minister...
1
by: Zorpiedoman | last post by:
I have many different projects and solutions I am working on. All but one of them work fine. One of them, for a reason I can't figure out, has stopped 'auto formatting' as I work in the...
3
by: Robin Tucker | last post by:
Hi there, I have this really frustrating problem with Visual Studio (Microsoft Visual Basic .NET 2003 69586-335-0000007-18843). I have got used to using the autocomplete and auto indent...
7
by: Aaron | last post by:
I like some of the auto-formatting features of VB.NET (god help me) but I really prefer to use CSharp (C#) is there any way to get the features of auto-indenting, auto-capitalization, and advanced...
5
by: Divvy Ballacks | last post by:
Hello, does anyone know of such a freebie. If so a link would be much appreciated.
0
by: Jack | last post by:
How to enable the auto indent function in visual studio? For example: void f() { for(int i = 0; i < 10; i++) { cout << a; //When I type this line, indent automatically. }
18
by: MNNovice | last post by:
I have a table called tblFunds with these fields: FundID (PK / Auto), FundNo (Text), FundDescr(Text), GrantNo (Text). In a form I have several fields that came from different tables. Two of the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.