Ruby > Python so far...

Posted by hardwarehank, Sat Aug 26 11:55:42 UTC 2006

So, I found out I need to learn Python in some capacity for my new job. I’m currently teaching myself, and that’s going well, except for one small problem - there’s no ternary operator. I mean, you can cheat and use an array:


[<false code>,<true code>][<conditional expression>]

But how does that start looking if you are nesting them? Completely unreadable. This is a much better idea:


<conditional expression> ? <true code> : <false code>

Would it be so bad to include in the language? I think not.

Tags:

Comments

Have your say

A name is required. You may use Markdown in your comments.