Tabbing/Spaces

Tim Peters tim.one at home.com
Fri Jan 19 23:22:41 EST 2001


[Robert L Hicks]
> ...
> While reading the reference manual it denotes that 8
> spaces is that standard for indentation.

[Tim]
> Where?  The Python compiler deals with a tab character by
> moving to the next multiple-of-8 column, but that's just
> a (hardcoded) fact.

[Emile van Sebille]
> From the Reference Manual:
>
> 2.1.7 Indentation
> Leading whitespace (spaces and tabs) at the beginning of a
> logical line is used to compute the indentation level of the
> line, which in turn is used to determine the grouping of
> statements.
>
> First, tabs are replaced (from left to right) by one to
> eight spaces such that the total number of characters up to
> and including the replacement is a multiple of eight (this
> is intended to be the same rule as used by Unix). The total
> number of spaces preceding the first non-blank character
> then determines the line's indentation. Indentation cannot
> be split over multiple physical lines using backslashes; the
> whitespace up to the first backslash determines the
> indentation.

As I said, that merely defines what the Python compiler *does* with a tab
character, which is just a fact.  It doesn't say anything about 8 columns
being "[a] standard for indentation" (which indeed it is not, but AFAIK the
Ref Man is silent on that issue).  So Robert is thinking of something else,
or neither of you knows how to read Dutch <wink>.





More information about the Python-list mailing list