summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2008-12-15 08:43:10 (GMT)
committerGeorg Brandl <georg@python.org>2008-12-15 08:43:10 (GMT)
commit861ac1fbaf17d076cf78a60b90e59c957a732637 (patch)
tree9a508cfecca812bf6a79c788a94ebf1d3d0455a3 /Doc
parenta3deea13127f8870f5417cd128de46d161a6f54b (diff)
downloadcpython-861ac1fbaf17d076cf78a60b90e59c957a732637.zip
cpython-861ac1fbaf17d076cf78a60b90e59c957a732637.tar.gz
cpython-861ac1fbaf17d076cf78a60b90e59c957a732637.tar.bz2
#4603: Note that inconsistent tab/space use is now illegal.
Diffstat (limited to 'Doc')
-rw-r--r--Doc/reference/lexical_analysis.rst16
1 files changed, 10 insertions, 6 deletions
diff --git a/Doc/reference/lexical_analysis.rst b/Doc/reference/lexical_analysis.rst
index 1e43128..83d3b8b 100644
--- a/Doc/reference/lexical_analysis.rst
+++ b/Doc/reference/lexical_analysis.rst
@@ -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
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
+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.
+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
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