[Python-ideas] Making colons optional?

Riobard Zhan yaogzhan at gmail.com
Fri Feb 6 07:42:36 CET 2009


On 5-Feb-09, at 6:10 PM, Ben Finney wrote:

> Riobard Zhan <yaogzhan at gmail.com> writes:
>
>> On 5-Feb-09, at 7:31 AM, Steven D'Aprano wrote:
>>
>>> I'm sorry you dislike colons, but I like them.
>>
>> Yes I agree with you that many people like colons. What bothers me is
>> that some people dislike them, but not given the choice to avoid  
>> them.
>
> That argument doesn't address the point of the existing syntax. I (and
> presumably Steven) like the colons in code *when I have to read it*.
>
> If they are optional, and some significant proportion of coders stop
> using them to introduce a suite, then they entirely lose their strong
> association with “here comes a suite” that is the main benefit of
> having them as complulsory syntax.

Your strong association with "here comes a suite" should come from  
indentation, that's how Python works. Or you should fallback to  
opening and ending braces like Java/C (or even old school begin-end  
keywords) if you fail to do so.

>> We don't like semicolons in Python, but what would stop a hard-core
>> C users to end every statement with a semicolon? They have the
>> choice.
>
> Laziness (the good kind). Once someone discovers that they *don't have
> to* add the semicolons, and it doesn't affect the operation of their
> program, those semicolons will, I predict, become much less frequent.

"Once someone discovers that they *don't have to* add the colons, and  
it doesn't affect the operation of their program, those colons will, I  
predict, become much less frequent. "

Thank God, finally we are on the right track. Making colons optional  
is just the first step to kill both semicolons and colons all together. 


More information about the Python-ideas mailing list