Python indentation deters newbies?

Anthony Baxter anthonybaxter at gmail.com
Fri Aug 13 12:24:03 EDT 2004


On 13 Aug 2004 07:15:14 -0700, beliavsky at aol.com <beliavsky at aol.com> wrote:
> One of the most commmon reasons programmers cite for not trying Python
> is that indentation determines the program flow -- they think its
> weird. I think programmers who actually try Python adapt quickly and
> do not find the indentation rules to be a problem.
> 
> I wonder if there is a way to remove this initial barrier. Could an
> alternate source form be defined, so that there are matching if-endif
> and for-next constructs instead of significant indentation? The
> alternate source form and the current form would result in exactly the
> same .pyc file.

Luckily, the time machine has already been used to implement this. 
At the end of an 'if' statement, you can put a "#endif". And in a for
loop, you can put a "#endfor" at the end. The '#' is to indicate that it's
not the preferred form.

In all seriousness - people who bounce off Python because of the
indentation are probably just not willing to learn a new language, or
else they're incredibly bigoted towards whatever language (often
C) that they're used to. Their loss.



More information about the Python-list mailing list