[Python-checkins] r67786 - python/branches/py3k/Doc/reference/lexical_analysis.rst

georg.brandl python-checkins at python.org
Mon Dec 15 09:43:10 CET 2008


Author: georg.brandl
Date: Mon Dec 15 09:43:10 2008
New Revision: 67786

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


Modified:
   python/branches/py3k/Doc/reference/lexical_analysis.rst

Modified: python/branches/py3k/Doc/reference/lexical_analysis.rst
==============================================================================
--- python/branches/py3k/Doc/reference/lexical_analysis.rst	(original)
+++ python/branches/py3k/Doc/reference/lexical_analysis.rst	Mon Dec 15 09:43:10 2008
@@ -174,14 +174,18 @@
 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


More information about the Python-checkins mailing list