For review: PEP 308 - If-then-else expression

Erik Max Francis max at alcyone.com
Sat Feb 8 14:02:49 EST 2003


Andrew Dalke wrote:
> 
> Huh.  I keep saying "trinary" instead of "ternary".
> 
>   :(

Really, they're both synonymous (at least I could find no formal
distinction in mathematics in my searches).  Both just mean "having to
do with three."

The real misnomer here is that people keep referring to the conditional
operator as _the_ ternary operator.  A ternary operator is just an
operator that manipulates three operands; the conditional operator p ? x
: y (or whatever form it eventually takes in Python, if adopted) is
really just one of any number of possible ternary operators.  In
computer science, of course, it's by far the most common ternary
operator -- nearly to the exclusion of all others -- but there's no
reaosn there couldn't be other ternary operators having nothing to do
with the conditional operator.

-- 
 Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
 __ San Jose, CA, USA / 37 20 N 121 53 W / &tSftDotIotE
/  \ So look into my eyes / I won't tell you lies
\__/ Neneh Cherry
    Official Omega page / http://www.alcyone.com/max/projects/omega/
 The official distribution page for the popular Roguelike, Omega.




More information about the Python-list mailing list