Python indentation

Mark 'Kamikaze' Hughes kamikaze at
Tue Jul 13 23:23:34 CEST 2004

Antoon Pardon <apardon at>
wrote on 13 Jul 2004 07:10:06 GMT:
> Op 2004-07-12, Mark 'Kamikaze' Hughes schreef <kamikaze at>:
>> Antoon Pardon <apardon at>
>> wrote on 12 Jul 2004 11:19:50 GMT:
>>> Op 2004-07-09, Mark 'Kamikaze' Hughes schreef <kamikaze at>:
>>>>   This confuses me as to where the loop starts and ends:
>>> This confusion may be nothing more than your unfamiliary which
>>> such a construct.
>>>> linenum=1
>>>> while True:
>>>>     line = raw_input()
>>>> and while line:
>>>>     print "%05d:%s" % (linenum, line,)
>>>>     linenum += 1
>>   No, I am quite certain that my confusion is due to the block
>> indentation aimlessly wandering out, then in, then out again, then in at
>> the end.  And I'm supposed to visually identify that as a single flow of
>> execution?  Bugger that.
> It is as much a single flow of execution as an if elif else.


if A:
elif C:

  This structure looks very similar to the "and while" proposal, but is
totally different, since B, D, and E are in separate flows of execution.

>>   I've programmed in dozens of languages.  None but BASIC and various
>> assembly languages have a loop structure quite so ugly as that.
> What I don't care about uglyness.

  We can stop right there, then.  One of Python's major attractions to
me, at least, is that the most readable, pleasant code is almost always
the most correct.  This means that in 6 months or 6 years when I come
back to my code, I can pick it up immediately.  I care very much about
ugliness.  Programming in Python means never feeling ashamed of your

  At least a few other people share this principle:
python -c "import this"

>>   Python wins now because it is simple, and clear, and there's one
>> explicitly correct way to solve most tasks.
> No there is not.

  I'm sorry, your time is up.  If you wish to continue the argument,
please pay the receptionist 5 pounds.

 <a href=""> Mark Hughes </a>
"The void breathed hard on my heart, turning its illusions to ice, shattering
 them.  Was reborn, then, free to scrawl own design on this morally blank
 world.  Was Rorschach." --Alan Moore, _Watchmen #6_, "The Abyss Gazes Also"

More information about the Python-list mailing list