You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
IDLE not smart indenting correctly in nested statements #52532
I don't think this is specific to IDLE; it also happens when launching the python interpreter directly from a terminal on OS X or Linux. (BTW, what platform are you on?)
As far as I can tell, the TAB character is simply advancing to the next tab stop; those tab stops are determined by the terminal, and can be controlled with the 'tabs' command on Linux. Though if you're using the readline library, that seems to override or reset the tab settings somehow.
Mark: customizing tabs to be anything but 8 spaces is inadvisable with Python, because Python always parses them as 8.
Sooner or later one would mix tabs and spaces and the result would be really painful to debug.
Activity
Tofystedeth commentedon Apr 1, 2010
huh, somehow I submitted this before I was done, sorry bout that.
IDLE (the shell, not the text editor) doubles the indentation when in nested statements.
For instance
while True:
while True:
while True:
mdickinson commentedon Aug 5, 2010
I don't think this is specific to IDLE; it also happens when launching the python interpreter directly from a terminal on OS X or Linux. (BTW, what platform are you on?)
As far as I can tell, the TAB character is simply advancing to the next tab stop; those tab stops are determined by the terminal, and can be controlled with the 'tabs' command on Linux. Though if you're using the readline library, that seems to override or reset the tab settings somehow.
Tofystedeth commentedon Aug 5, 2010
You're right, it also does it when I use the Python shell from the command prompt. I'm running Windows Vista 32bit SP2.
terryjreedy commentedon Jan 16, 2012
The current indentation is a consequent of using tabs for indents.
Changing that is the subject of bpo-7676.
bpo-1196946 is a similar issue.
cben commentedon Jan 17, 2012
Mark: customizing tabs to be anything but 8 spaces is inadvisable with Python, because Python always parses them as 8.
Sooner or later one would mix tabs and spaces and the result would be really painful to debug.