Py3K idea: why not drop the colon?

Dan Lenski dlenski at gmail.com
Thu Nov 9 19:06:37 EST 2006


Ben Finney wrote:
> > I think the colon could be omitted from every type of compound
> > statement: 'if', 'for', 'def', 'class', whatever. Am I missing
> > anything?
>
> A use case. What problem is being solved by introducing this
> inconsistency?

I agree completely.  And as a recent convert to Python, I have to say
that I *like* the colons.  I found the whitespace-and-colon thing
really irritating... for about 2 hours.

The colon makes it easier to eyeball where a block statement begins in
the absence of braces around the block, it allows one-line if
statements (which I use a lot), and it means that even the stupidest,
simplest editor can figure out where auto-indentation is needed, namely
following any line that ends with a colon (except in a triple-quoted, I
guess).

Contrast that with Perl, where in years of professional and hobby use I
have not found a single editor that gets indentation right more than
about 90% of the time.  The syntax is too darn complicated.  With
Python, figuring out where to auto-indent is trivial.  Works for me.

Dan




More information about the Python-list mailing list