[Python-Dev] Adding C ternary select (a?b:c) to Python?

Fred L. Drake, Jr. fdrake@acm.org
Mon, 31 Jan 2000 12:08:11 -0500 (EST)


Ka-Ping Yee writes:
 > a scan through a decent chunk of Python would be useful to find out how
 > often this construct (in its "and"/"or" incarnation) actually gets used.

  I'm not sure what the survey provides other than a lower bound.  I
think most Python programmers who want the ?: functionality avoid the
and/or approach because of the ugliness.  I know I do.
  But I'd really like to have the functionality if the syntax is
reasonable!  I could live with something like "if cond then true else
false"; the leading "if" is visually important; without it, you have
to scan over the test expression to find the "then", and that makes it
harder to read.


  -Fred

--
Fred L. Drake, Jr.	  <fdrake at acm.org>
Corporation for National Research Initiatives