From: Dotan Cohen on
On 30 March 2010 18:40, gentlestone <tibor.beck(a)> wrote:
> Hi, how can I write the popular C/JAVA syntax in Python?
> Java example:
>    return (a==b) ? 'Yes' : 'No'
> My first idea is:
>    return ('No','Yes')[bool(a==b)]
> Is there a more elegant/common python expression for this?

I'm a little late to the party, but I just saw this in Dive Into Python:
multiple = 1024 if a_kilobyte_is_1024_bytes else 1000

It's kind of sloppy as the condition is between the possible values,
but it works.

Dotan Cohen

Please CC me if you want to be sure that I read your message. I do not
read all list mail.