Python indentation (3 spaces)

Karsten Hilbert Karsten.Hilbert at gmx.net
Fri Oct 5 17:35:33 EDT 2018


On Sat, Oct 06, 2018 at 12:23:49AM +0300, Serhiy Storchaka wrote:
> > 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()

That is only incidental because the "width" of a tab stop is
what you define it to be. On my system it might just be 3
spaces which would turn your argument on its head.
Karsten
-- 
GPG 40BE 5B0E C98E 1713 AFA6 5BC0 3BEA AC80 7D4F C89B


More information about the Python-list mailing list

AltStyle によって変換されたページ (->オリジナル) /