Py3K idea: why not drop the colon?

Hendrik van Rooyen mail at
Sat Nov 11 07:27:49 CET 2006

"Fredrik Lundh" <fredrik at> wrote:

>  >>> color = "blue"
>  >>> if color == "red" or "green" or "yellow":
> ...     print color, "is red or green or yellow"
> ...
> blue is red or green or yellow

*grin* - this can be construed as a weakness in Python -

Even COBOL compilers in the sixties would "add in" the implied
"if color = " after each 'or', instead of bloody - mindedly thinking:

ok the first condition is not true
the second "condition" 's string is not empty,
so take the true path...

BUT -  the other way leads naturally to abominations like:

if color not equal to 'red' or 'green' or 'yellow'....

where 'green' and 'yellow' takes the "wrong" path,
as neither is equal to red, when what you wanted was:

if color not equal to 'red' and 'green' and 'yellow'...

Long live de Morgan!

In this Python simply requires you to be specific in what you want,
which is in a sense a GoodThing, seen as a BadThing by lazy programmers.

And as for the colon :   colon schmolon - its irrelevant either way,
but if the interpreter requires it, you have no choice but to type it...

Programming is basically about guessing what was in the mind of the compiler

- Hendrik

More information about the Python-list mailing list