PEP 308: ternary operator
Raymond Hettinger
vze4rx4y at verizon.net
Thu Feb 20 17:02:51 EST 2003
> "Terry Hancock" <hancock at anansispaceworks.com> wrote:
> > 1) Is it <cond>? <a>:<b> or <cond>: <a>?<b>
> > I can never remember this!
>
> <a> and <b> are answers, <cond> is the question.
> The question is followed by a question mark.
>
> Quite logical, actually.
>
> - Anders
Also, the use of c?a:b in other languages is an important
consideration so that skills are transferrable both to and
from Python. That syntax is used in enough other places
to make it a valuable thing to know.
Raymond Hettinger
More information about the Python-list
mailing list