Significant whitespace

Steven D'Aprano steve at REMOVE-THIS-cybersource.com.au
Sat Jan 2 02:05:51 CET 2010


On Fri, 01 Jan 2010 14:19:28 -0800, Chris Rebert wrote:

> For those of us who weren't around during the heyday of FORTRAN, can
> anyone describe this apparently much-reviled significant whitespace
> feature that continues to make some programmers unjustly fearful about
> Python's use of indentation?


I'm not a Fortran expert, but I understand that whitespace was optional 
within lines unless needed to make something unambiguous.

In Python terms, imagine if we could write

    foriinrange(10):

instead of the usual 

    for i in range(10):

Since the colon makes it unambiguous that it is some sort of block 
construct, and it starts with "for", it must be a for loop. Pretty 
horrible, yes?


-- 
Steven



More information about the Python-list mailing list