Python indentation deters newbies?

Antoon Pardon apardon at forel.vub.ac.be
Tue Aug 17 04:38:48 EDT 2004


Op 2004-08-16, Peter Hansen schreef <peter at engcorp.com>:
> Richard Hanson wrote:
>> For me, a not insignificant part of Python's genius *is* the
>> indentation. When I used C and C++ I was a stickler (pedant? :-)
>> ) for "proper" indentation -- which was a PITA. So -- I took to
>> Python's indentation like a duck to water.
>
> That's been exactly my situation as well, which leads me to
> theorize that those who react most strongly against Python's
> syntactically significant indentation are those who were the
> least consistent or, uh, "anal" about making sure their code
> conformed to conventions.
>
> The corollary would be that those who already wrote code which
> would have been accepted by a compiler which checked indentation,
> are those who hardly blink when encountering Python,
> other than to say "Of course!" as you did, and carry on writing
> code just as they used to, with a mild feeling of dismay that
> it never occurred to them before to question the supposed
> value of braces or begin/end tags.

I think both have their value. I still prefer modula2 style.
No begin (*) tags as the block is automtically started by
any compound statement so you only needed an end tag. My
experience is that proper indentation end end tags makes
for the best readabilty, better than either of them on
their own. And mostly I add comments to the end tags
to better see what control structures they end.

(*) This is not strictly true, there is a begin tag
but that was only used to start the body of a
procedure or module, not for compound statements.

-- 
Antoon Pardon



More information about the Python-list mailing list