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

Christopher Petrilli petrilli@amber.org
Sun, 30 Jan 2000 19:54:06 -0500


The question comes from what "problem" you're trying to solve.  The ?: syntax
does not introduce any new "functionality" to the language, nor does it
make it capable of solving problems or requirements that it can not do
at the current time.

The second qustion I'd ask is, who is this aimed at?  It's certainly not
aimed at first-time programmers, as I know from experience that the ?:
is one of the hardest things to teach people in C (after pointers), and
often I leave it out of training when I did it.  It's simply a "shorthand"
not a new functionality.  If its aimed at experienced programmers, I'd 
argue that it's at best "non-pythonic" and at worst a hack, taken from
a language in which it exposes the "macro assembler" approach.

Python is not a language that has been optimized for "minimal typing", it's
much more verbose than most languages, and so that argument shouldn' be
applied.  Perhaps it's for optimization?  That was I believe the original
argument made for it in K&R, in that optimizers in that day were rather
antiquated, wheras today, I believe that any C compiler would get it
right if it were expressed in its full form. (Timbot?)

So, it comes down to a few questions for me:

	Does it solve a new problem?	No
	Is it pythonic?			No
	Does it make it faster?		No

Given Pyton's CP4E goals, and its general place as an easy to use 
language, I'd argue this patch would be counter to all of those goals.

Sorry if I pushed someone's buton, but... I saw a lot of hints at making
Python MUCH more complex, which is counter to why I changed and dropped
many other languags.

Chris
-- 
| Christopher Petrilli
| petrilli@amber.org