[Python-ideas] Making colons optional?

Christian Heimes lists at cheimes.de
Thu Feb 5 17:53:46 CET 2009

Riobard Zhan schrieb:
> On 5-Feb-09, at 10:04 AM, Christian Heimes wrote:
>> -1
>> Please keep Python sources readable.
>> Christian
> -1
> Please elaborate (better yet, give concrete examples) why it makes
> Python code less readable.
> The reason I propose to make colons optional is that I fail to see
> colons make code more readable. They seem to be line noise to me. You
> might disagree, but please explain why.

The colon at the end makes it clear it's the end of the statement, too.

Some example:

   def method(self, some, very, long, method,
              going, over, lots,
              and, lots,
              and, lots, of, lines):

The second example makes it even more obvious:

    if (some() and some_other() or some_more(complex=(True,))
        and a_final_call(egg=(1,2,3))):

You see a line starting with "if" but not ending with a colon. You know
for sure that you have to search for a trailing colon in order to find
the end of a very long "if" line.

Yes, the colon is extra noise but it's the kind of good noise that makes
life more joyful like the noise of rain on a roof. Did you notice that
I'm using a colon in my regular postings, too? I've used two colons to
separate my text from the examples. Colon separators are natural to me.


More information about the Python-ideas mailing list