Auto indents (was Re: How to set the history commands visible ?)

Terry Reedy tjreedy at udel.edu
Mon Sep 14 00:56:23 CEST 2015


On 9/13/2015 1:15 PM, Glus Xof wrote:

> Is yet an automatic indentation system implemented ?

The Idle editor does pep8-aware 'smart indenting'.  In the following, 
'|' indicates the cursor position after <Enter> is pressed.
A ':' at the end of the line adds 1 indent -- unless there is an opener 
that has not been closed.  So what looks like a buggy indent usually 
indicates a syntax error in the user code.

a = 3
|
if a == 3:
     |pass
a = int(len({})
         |) # pep 8 positioning
a = int(
     |) # pep 8 positioning
if a = 3:
     if b = 5:
         |pass
if a == int(len({}):
             | # unclosed int(

-- 
Terry Jan Reedy



More information about the Python-list mailing list