[Python-Dev] Trinary Operators

Christopher Blunck blunck@gst.com
Wed, 5 Feb 2003 23:30:26 -0500


I have a brief and quick question-

What was the reasoning for not supporting trinary operators in py?

One of the great things I love about py is how much bang for your buck you
get per line of code.  I can do much more in 10 lines of py than I can do in
Java.  Being able to do something like this would really help me:
  bigger = a > b ? a : b

My workaround is to:
  def if_else(test, a, b):
    if test:
      return a
    else:
      return b
  
  bigger = if_else(a > b, a, b)


I assume this was discussed (at some point).  Was it just determined to be
"syntactic sugar" or was there some higher reason?

-c

-- 
 11:25pm  up 107 days, 15:00,  3 users,  load average: 7.67, 6.54, 6.20