Python indentation (3 spaces)

Serhiy Storchaka storchaka at gmail.com
Fri Oct 5 17:23:49 EDT 2018


05.10.18 23:53, Chris Angelico пише:
> I don't understand how three spaces would prevent errors in a way that
> four wouldn't.
In many editors and on terminal

for a in x:
     if a:
         b()
<-tab-->c()

looks indistinguishable from

for a in x:
     if a:
         b()
         c()

but the former is a syntax error in Python 3.

If use 3-space indentation this error is more visible:

for a in x:
    if a:
       b()
<-tab-->c()




More information about the Python-list mailing list