[Python-ideas] Making colons optional?

Riobard Zhan yaogzhan at gmail.com
Thu Feb 5 20:47:06 CET 2009


On 5-Feb-09, at 3:37 PM, Leonardo Santagada wrote:

>
> On Feb 5, 2009, at 4:12 PM, Riobard Zhan wrote:
>
>> I think omitting colons makes Python more elegant--more uniform,  
>> less clutter. It's an itch every time I see a piece of Ruby code  
>> with lots of def's and if's without trailing colons ...
>
>
> Could you explain to us how ruby does it?
>
> ps: Just remember that they do have an end in the end of suites  
> (which in my opinion look worse than the colons...)



I don't like the end-end-end-end part of Ruby either. But they do have  
better starting part IMO.

def foo(var)
     if var == 10
         print "Variable is 10″
     else
         print "Variable is something else"
     end
end



(Note this is actually an optional "then" keyword at the end of "if")



More information about the Python-ideas mailing list