Whitespace as syntax (was Re: Python Rocks!)

Gordon McMillan gmcm at hypernet.com
Tue Feb 8 08:05:18 EST 2000


fcahoon at my-deja.com writes:
> 
> Suppose that I'm one of those set-tabs-to-logical-indentation sorts of
> guys, so I set my tab width to 4, then look at this code in my editor.
> Gee, it sure _looks_ like statement4 belongs to "if condition1"!  And,
> if I convert tabs to spaces when I save, statement4 _will_ belong to "if
> condtion1".  I've just unwittingly changed the logic of the code!
> 
> You may, of course, argue that this is unlikely, but it is still
> plausible enough to make me _very_ nervous.

Notice that it is *only* the last line in a block where this 
misunderstanding can still yield syntactically valid code, and 
only when the new interpretation of tab is smaller than the old.

- Gordon




More information about the Python-list mailing list