Python indentation deters newbies?

beliavsky at beliavsky at
Mon Aug 16 15:12:07 CEST 2004

Peter Hansen <peter at> wrote in message news:<AuWdnUL93se81L3cRVn-hQ at>...

> For example, if 90% of people who have the "indentation rash"
> had previous encounters with FORTRAN IV, then it ought to
> be possible to make it obvious in the early documentation
> (tutorial, intro page, etc) that Python is not FORTRAN and
> doesn't suffer from the same limitations with respect to
> indentation/whitespace significance as FORTRAN does.

Uh oh, people are picking on my beloved Fortran :).

Fortran IV was standardized as Fortran 66. Even the following Fortran
standard, Fortran 77, had only "fixed format" with the rigid column
restrictions. The Fortran 90 standard introduced free format, and I
think such code resembles Python more closely than other compiled
languages, because there are no semicolons needed to terminate lines,
and curly braces are not used to delimit blocks.

It would be misleading to discuss certain flaws of earlier versions of
Fortran without mentioning that they have long since been corrected.
Btw, the official spelling has been "Fortran" (not all uppercase)
since the 1990 standard.

I have done a good bit of coding in both Python and Fortran and still
(mildly)prefer using key words rather than indentation to terminate
blocks, for example

do i=0,9
   ! some code

compared to

for i in range(10):
   # some code

In Fortran you easily wrap a do-enddo or if-endif around a block of
code without touching the interior lines. This is useful for
debugging. If the change is permanent, the code should be re-indented.
In Python the indentation must be correct at all times, which can be

More information about the Python-list mailing list