Let's make Python really strict about indentation
Alexis Layton
alexis.layton at post.harvard.edu
Mon Dec 3 13:18:40 EST 2001
Alexis Layton wrote:
> I'm starting to believe the only solution to the indentation "mixups"
> that occur
> is to have Python become really strict about indentation, yet still
> allow a mixture
> of spaces and tabs.
>
My previous post still does not address one common use-case (the Unix
editor case)
where tab-stops are 8 and indentation level is 4, where the following
sequences
arise
SSSS
T
TSSSS
TT
TTSSSS
TTT
This pattern, as well as all common ones, can be addressed by defining
(for the purposes of lexical analysis of Python) that the tab stop is
some sufficiently
large integer, say 256. Or one can use the algorithm described in my
earlier post
but allow a single T to be more indentation than any number of Ss.
This would allow any internally consistent file to be parsed but
disallow ad-hoc
mixtures of identation.
Alexis Layton
More information about the Python-list
mailing list