# Vote on PEP 308: Ternary Operator

Manuel M. Garcia mail at manuelmgarcia.com
Mon Mar 3 03:24:14 CET 2003

```On 2 Mar 2003 02:25:46 -0800, pep308vote at hotmail.com (Raymond
Hettinger) wrote:
(edit)
>Write-out these five examples using your most preferred syntax:
>    x = "door" + (if quantity>1: "s" else: "")
>    data = (if hasattr(s, 'open'): s.readlines() else: s.split())
>    z = 1.0 + (if abs(z) < .0001:  0 else: z)
>    t = v[index] = (if t<=0: t-1.0 else: -sigma /(t + 1.0))
>    return (if len(s)<10: insertsort(s) else: quicksort(s))

I think it is too bad a nested example wasn't required.  If the
ternary operator is added, and Python continues relentless world
domination ;-) , I will probably have to puzzle out somebody's
unfortunate nested ternary operator expression... at least once in my
life.

This might give even the most rabid supporter pause.

>SAMPLE BALLOT
>-------------
>C accept  (if c: x else: y)
>D reject  c ? a : b
>H reject  c then a else b
>John Jones
>x = "door" + (if quantity>1: "s" else: "")
>data = (if hasattr(s, 'open'): s.readlines() else: s.split())
>z = 1.0 + (if abs(z) < .0001:  0 else: z)
>t = v[index] = (if t<=0: t-1.0 else: -sigma /(t + 1.0))
>return (if len(s)<10: linsort(s) else: qsort(s))

It is also too bad that examples of how to helpfully reject all
ternary operator forms were not given.

There would be 2 cases of rejecting the ternary operator:

1.  Horrified, but still able to rank 3 in order of least offense.
(These would be people who have been steeled by voting in recent
US presidential elections...)
These voters could follow the format of lines 1 through 4, but be
spared typing the examples.

2.  Horrified, and reduced to Lovecraftian psychic jelly by all
ternary operator syntax.
These voters could compose obscene ASCII art to express the full
measure of their contempt and disgust.
Or use the single word 'REJECT', perhaps punctuated by writing the
5 examples in proper old-fasioned Python.

>Vote Early.  Vote Once.

Mr. Raymond Hettinger must not be from Chicago.

Manuel

```