Commit fd6c130c authored by Georg Brandl's avatar Georg Brandl

#4603: Note that inconsistent tab/space use is now illegal.

parent 928ef2de
...@@ -174,14 +174,18 @@ Leading whitespace (spaces and tabs) at the beginning of a logical line is used ...@@ -174,14 +174,18 @@ 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 to compute the indentation level of the line, which in turn is used to determine
the grouping of statements. the grouping of statements.
First, tabs are replaced (from left to right) by one to eight spaces such that Tabs are replaced (from left to right) by one to eight spaces such that the
the total number of characters up to and including the replacement is a multiple total number of characters up to and including the replacement is a multiple of
of eight (this is intended to be the same rule as used by Unix). The total eight (this is intended to be the same rule as used by Unix). The total number
number of spaces preceding the first non-blank character then determines the of spaces preceding the first non-blank character then determines the line's
line's indentation. Indentation cannot be split over multiple physical lines indentation. Indentation cannot be split over multiple physical lines using
using backslashes; the whitespace up to the first backslash determines the backslashes; the whitespace up to the first backslash determines the
indentation. indentation.
Indentation is rejected as inconsistent if a source file mixes tabs and spaces
in a way that makes the meaning dependent on the worth of a tab in spaces; a
:exc:`TabError` is raised in that case.
**Cross-platform compatibility note:** because of the nature of text editors on **Cross-platform compatibility note:** because of the nature of text editors on
non-UNIX platforms, it is unwise to use a mixture of spaces and tabs for the non-UNIX platforms, it is unwise to use a mixture of spaces and tabs for the
indentation in a single source file. It should also be noted that different indentation in a single source file. It should also be noted that different
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment