Significant whitespace

Roy Smith roy at panix.com
Fri Jan 1 18:29:24 EST 2010


In article <mailman.319.1262384371.28905.python-list at python.org>,
 Chris Rebert <clp2 at rebertia.com> wrote:

> On Fri, Jan 1, 2010 at 2:02 PM, Dan Stromberg <drsalists at gmail.com> wrote:
> > I put together a page about significant whitespace (and the lack thereof).
> >
> > You're invited to check it out:
> >
> > http://stromberg.dnsalias.org/~dstromberg/significant-whitespace.html
> 
> 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 know it's bad form to cite yourself, but I think I said it pretty well 
(oh my) 12 years ago:

http://www.python.org/doc/humor/#bad-habits

To address your question more directly, here's a couple of ways Fortran 
treated whitespace which would surprise the current crop of 
Java/PHP/Python/Ruby programmers:

1) Line numbers (i.e. the things you could GOTO to) were in column 2-7 
(column 1 was reserved for a comment indicator).  This is not quite 
significant whitespace, it's more like significant indentation.

2) Whitespace was not required in many places.  For example, the following 
two statements (this will only make sense in a fixed-width font) are 
identical:

       DO 10 I = 1, 10
       DO10I=1,10

People make fun of Fortran these days, but it was a staggeringly important 
advance in software development compared to what came before (i.e. 
assembler).  The move from assembler to Fortran was a far more significant 
advance than the move from, say, Perl to Python.



More information about the Python-list mailing list