ternary operator

Erik Max Francis max at alcyone.com
Thu Feb 6 18:53:26 EST 2003


Paul Rubin wrote:

> But if the most
> frequently asked question in c.l.py is how do you enter a number in
> decimal instead of octal, and the answer is always "you can't, but you
> don't really need to" followed by long threads exchanging favorite
> contorted workarounds for the problem, then maybe, just maybe, the
> people who keep asking how to do it really have identified a
> legitimate missing capability in the language.  Sigh.

Well said.  I still hold out on the possibility of Those In Power
changing their minds and including a conditional operator in a future
version.  When I first started using Python, the three things I
genuinely missed were augmented assignments (although admittedly not
much), a separate Boolean type, and a conditional operator.

Augmented assignments were added to 2.0, and Booleans are now being
added to 2.3 (in a sudden change of heart and a declaration), both with
minimal impact; of the two, Booleans are far more "invasive" and even
then they'd only serve to be problematic in pathological code. 
Conditional expressions, whatever syntax is chosen, also promise to have
utterly minimal impact (since whatever form it takes, it will have been
illegal before its introduction so it's automatically backward
compatible).

In some sense Booleans were a much harder sell than conditional
expressions, and now Booleans are in.  Augmented assignments, surely,
had more ramifications on the parser and support methods than
conditional expressions would.

Maybe (at least, I still hope) a similar fate awaits conditional
expressions in the future.

-- 
 Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
 __ San Jose, CA, USA / 37 20 N 121 53 W / &tSftDotIotE
/  \ War is like love, it always finds a way.
\__/ Bertolt Brecht
    Bosskey.net: Return to Wolfenstein / http://www.bosskey.net/rtcw/
 A personal guide to Return to Castle Wolfenstein.




More information about the Python-list mailing list