I don't understand PEP 308.

Tetsuo member16943 at dbforums.com
Thu Mar 13 20:20:52 CET 2003

Originally posted by Greg Krohn 
> Basically, instead of:
>     if cond:
>         a = tval
>     else:
>         a = fval
> You can do:
>     a = cond ? tval : fval 

So it's just syntactic sugar? I assumed it lets you do something new and
cool, that's why I was confused.

Nah, that can't be it... The PEP says that usually, the ternary is
"emulated" in some ugly ways, which don't include the if-then statement.

Posted via http://dbforums.com

More information about the Python-list mailing list