A Suggestion for Python Colon Syntax

David Allen s2mdalle at titan.vcu.edu
Wed Dec 20 23:14:42 EST 2000

In article <91tc8h$2pp$1 at hecate.umd.edu>, "William Djaja Tjokroaminata"
<billtj at y.glue.umd.edu> wrote:
> My suggestion is as follows:
> 1) If the if (or for, etc.) clause is followed by a block, then the
> colon
> is optional (for backward compatibility):
>     if condition is true
>         statement_1 statement_2
>         ....
> 2) If the if (or for, etc.) clause is followed only by a single
> statement,
> then the colon can be used to write a single line of code:
>     if condition is true: statement_1 next_statement
>     ....
> Any comments, anyone?

Me, I always want the colon to be there for one 
simple reason:  python-mode.el and emacs knows that
when I have a : on the end of a line, the next line
should be indented, and it does it for me.  :)

Sure, that's not a *language* reason for wanting the
colon there, but it's a reason.  :)

David Allen
Q: What can a goose do, a duck can't, and a lawyer should?
A: Stick his bill up his ass.

More information about the Python-list mailing list