Py3K idea: why not drop the colon?

skip at pobox.com skip at pobox.com
Fri Nov 10 09:27:43 EST 2006


    Neil> The colon's main purpose seems to be to allow one-liners:

    Neil> Easy to parse: if a < b: a += 1
    Neil> Hard to parse if a < b a += 1

    Skip> ... the ABC language designers found that indentation-based block
    Skip> structure by itself wasn't enough to clue new users in about the
    Skip> code structure.  Adding the colon at the end of the if/while/for
    Skip> clause helped.

One final note.  Just because the colon isn't technically required in many
situations doesn't mean it's superfluous.  If all language designers cared
about was ease of parsing we'd probably all be programming in assembler,
sendmail, brainfuck.  Or, as the Zen of Python says: "Readability counts".

Skip

P.S.  I felt I just had to tie this into the thread on profanity somehow.
But notice that I didn't mention nazis or Hitler. ;-)

S





More information about the Python-list mailing list