Python indentation (3 spaces)

Chris Angelico rosuav at gmail.com
Mon Oct 15 00:04:09 EDT 2018


On Mon, Oct 15, 2018 at 2:51 PM Alan Bawden <alan at csail.mit.edu> wrote:
>
> Chris Angelico <rosuav at gmail.com> writes:
> > On Mon, Oct 15, 2018 at 9:56 AM Alan Bawden <alan at csail.mit.edu> wrote:
> > > In my experience this is a very common way to assume that tabs will be
> > > interpreted.  Virtually every source-code file I have encountered since the
> > > mid 1970s (for any programming language or operating system) has assumed
> > > either this convention or, slightly less often, its 4-column variant.
> > >
> > > It's surprising that you've never encountered it.
> >
> > I've seen the four-column variant, but never the two. Maybe I just
> > move in different circles. In any case, I wouldn't say that "two space
> > indents, collapsed to a tab after eight" is somehow a universal
> > convention any more than four-space with or without collapsing.
>
> I think we're talking past each other somehow here.  I described the common
> 8-column interpretation, and the less common 4-column interpretation.  I
> did not mention, nor do I ever remember encountering in the wild, the
> 2-column variation.  (I _have_ seen the 10-column variation used -- it was
> the standard on Multics.)
> [chomp details]

I believe we are in agreement here - that it is common for a tab to be
interpreted as equivalent to eight spaces, but also that this is
definitely not the definition of the character. The convention that
I'm saying I have never seen is this:

On Mon, Oct 15, 2018 at 8:56 AM Marko Rauhamaa <marko at pacujo.net> wrote:
> However, it is trumped by an older
> convention whereby the indentation levels go as follows:
>
>    0:
>    1: SPC SPC
>    2: SPC SPC SPC SPC
>    3: SPC SPC SPC SPC SPC SPC
>    4: TAB
>    5: TAB SPC SPC
>    6: TAB SPC SPC SPC SPC
>    7: TAB SPC SPC SPC SPC SPC SPC
>    8: TAB TAB

Specifically that two-space indents and tab-collapsing are a
*convention*. I have never seen this used anywhere, much less seen it
commonly enough to call it a convention.

ChrisA



More information about the Python-list mailing list