osdir.com

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Python indentation (3 spaces)


On 2018-10-08, Peter J. Holzer <hjp-python at hjp.at> wrote:

> Theoretically I would agree with you: Just use a single tab per
> indentation level and let the user decide whether that's displayed
> as 2, 3, 4, or 8 spaces or 57 pixels or whatever.
>
> In practice it doesn't work in my experience.

Nor in mine.  On problem is that under Unix is that there isn't just
one place where you would need to configure the tab width.  There are
dozens of text-processing tools that get used on all sorts of text,
including program sources in a variety of languages.

For "just use tabs" to work, all of those tools would have to
magically recognize that they're looking at Python source and adjust
the tab size accordingly.  That isn't going to happen.

> There is always someone in a team who was "just testing that new
> editor" and replaced all tabs with spaces (or vice versa) or - worse
> - just some of them. It is safer to disallow tabs completely and
> mandate a certain number of spaces per indentation level.

Indeed. That's the only thing that actually works.

-- 
Grant Edwards               grant.b.edwards        Yow! Being a BALD HERO
                                  at               is almost as FESTIVE as a
                              gmail.com            TATTOOED KNOCKWURST.