[Python-ideas] Making colons optional?

Lie Ryan lie.1296 at gmail.com
Tue Feb 10 05:40:53 CET 2009

On Sun, 08 Feb 2009 03:17:14 -0330, Riobard Zhan wrote: 
>> I think it's a good indicator for optional syntax if you can formulate
>> new rules for PEP 8 that state when to use it.  In the case of colons,
>> you'd have to either forbid or mandate them; I'd be at a loss to find
>> another consistent rule.  So, making them optional is pointless; we
>> should either keep them or remove them.  And removing is out of the
>> question.
>> Applying that indicator to semicolons, there is a clear rule in PEP 8
>> that states when to use them: to separate two statements on one line.
> I thought semicolons and multiple statements on one line are discouraged
> in PEP 8. Did I miss something? :|

Discouraged doesn't mean you can't use them. In fact the first section of 
PEP8 after the "Introduction" is "A Foolish Consistency is the Hobgoblin 
of Little Minds". lambda is discouraged, but when you think using lambda 
is more readable then defining a function, use it. PEP 8 is made to 
increase readability of code, if there is any PEP8 rules that decreases 
readability in your code, violate the rule.

>> However, the only person around here whose itches alone, in the face of
>> a wall of disagreeing users, can lead to a change in the language, is
>> Guido.
> Agreed. That's what BDFL means.
> I'm not trying to impose my itches on you. I'm not the BDFL. I'm
> explaining why I think omitting colons makes Python more elegant.

And you have failed to convince others that it is "more" elegant.

>> Yes, I have read all those remarks about semicolons.
> Thanks very much! I thought you ignored them before. I apologize :)

Vice versa, we expect you to read other's post.

>>    What you all fail to recognize is that the majority of Python users
>>    like the colons, and wouldn't program without them.
> I doubt it. Would you not program other languages because they do not
> have colons? Do you really think the majority of Python users care about
> colons that much? I bet they will never notice if there is any colons
> missing in a piece of Python code if colons are made optional.

They might not notice it when they were writing it, but several days 
later when fixing an unrelated bug they would feel an itch.

More information about the Python-ideas mailing list