PEP 308: Alternative conditional operator forms

Erik Max Francis max at alcyone.com
Sun Feb 9 19:22:38 EST 2003


I'd like to build an exhaustive (or nearly so) of forms of the
conditional operator that have been made so far that people have thought
had _some_ merit (i.e., ones that were proposed and which someone other
than the proponent indicated they thought might be a good idea), and
those which Guido has not already absolutely dismissed (such as C ? x :
y).  I'd like to do this both for my own edification in seeing them all
in one place and for a potential second vote on the desired form (should
the process get that far, of course).  (I'm also putting aside for the
moment the issue of the introduction of new keywords or punctuation, or
the appearance of chained conditional operators.)

Note this is not a vote of any kind; the forms are listed in the very
rough chronological order of them being suggested, with no other implied
weighting on their position in the list.

Here is the list I have so far (C represents the conditional expression,
x the if-true expression, y the if-false one):

x if C else y # initial proposition in PEP
C ? x ! y # mentioned in PEP
(if C then x else y) # mentioned in PEP
x when C else y
(if C: x else: y)
C ? x else y
C -> x else y
C -> (x, y)

What else should be on this list?  (You can reply by email if you wish.)

-- 
 Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
 __ San Jose, CA, USA / 37 20 N 121 53 W / &tSftDotIotE
/  \ Light ... more light!
\__/ (the last words of Goethe)
    Bosskey.net / http://www.bosskey.net/
 A personal guide to online multiplayer first person shooters.




More information about the Python-list mailing list