colostomy

Remco Gerlich scarblac-spamtrap at pino.selwerd.nl
Wed Mar 29 09:34:23 EST 2000


dirck at pacbell.net wrote in comp.lang.python:
[ On needing the : at the end of control statements ]
> My thinking was, if the compiler is smart enough to put it in,
> why does it need to be there in the first place?
> what purpose does it serve?

Let's, we have several control statements... try, except, finally, for,
while, if, class, def, lambda... something like that. Why not call them t e
fi fo w i c d and l? :-) The compiler is smart enough for that...

The : is there for the same reason Python uses indentation as block markers
in the first place; there were studies done for the ABC language, with
subjects grading different block structures for readability (or something
like that). It was found that

block x:
   spam
   spam
   spam
   
Is *slightly* more readable than

block x
   spam
   spam
   spam

That's all. I agree with the study. Besides, I like it in editors, since the
editor can automatically indent the line after : <enter>, so block structure
is more automatic.

-- 
Remco Gerlich,  scarblac at pino.selwerd.nl
Hi! I'm a .sig virus! Join the fun and copy me into yours!



More information about the Python-list mailing list