The ternaery operator

Gregory Ewing greg.ewing at canterbury.ac.nz
Thu Mar 16 04:12:16 EDT 2017


Stefan Ram wrote:

> a if c else b
> 
>   Guido has invented something totally new. Why?

It's arguably closer to the way you would say such a
thing in English.

Consider the following sentences:

"I wear my red shirt if it's Tuesday, else my green one."

"I wear if it's Tuesday my red shirt, else my green one."

Which one sounds more natural?

-- 
Greg


More information about the Python-list mailing list