Python Quiz

Mark Jackson mjackson at alumni.caltech.edu
Wed Jul 16 09:35:32 EDT 2003


Michael Chermside <mcherm at mcherm.com> writes:
> richardc writes:
> > Im no expert but wouldnt you accept that Python has 'borrowed' FORTRAN's
> > fixed format syntax.  I can only think of Python and FORTRAN off the top of
> > my head which use whitespace as part of the syntax.
> 
> Definitely NOT. Without addressing the question of HOW Python came by the
> idea of using indentation to indicate block structure, it clearly couldn't
> have been from Fortran, because what Python does and what Fortran does
> are COMPLETELY different.
> 
> In Fortran, starting lines in particular columns is meaningful (as are other
> particular characters in particular leading columns). In Python, particular
> columns have NO meaning.

> Of course, I'm not suggesting that whitespace is *meaningless* in Python
> outside of indentation... Python is much like C (and many, many others) in
> that regard. After all, in C "y=x+ ++z" and "y=x++ +z" are quite
> different things. And in both Python and C "x=abc" is legal, but "x=a bc"
> is not.

Note that Fortran (at least historic Fortran - not sure about those
upstart 9x variants) is *not* among the "many, many others."  One can
write any of

	DO 10 I = something
	DO10I = something
	D O 1 0 I = something

and leave it to the compiler to figure out whether you're starting a
DO-loop or assigning a value to the variable DO10I.

[Signature from February 1993.]

-- 
Mark Jackson - http://www.alumni.caltech.edu/~mjackson
    Consistently separating words by spaces became a general custom
    about the tenth century A.D., and lasted until about 1957, when
    FORTRAN abandoned the practice.
				- Sun FORTRAN Reference Manual







More information about the Python-list mailing list