Ternary operator (Re: Ternery operator)

John Roth newsgroups at jhrothjr.com
Mon Sep 8 07:28:17 EDT 2003


"Michael Geary" <Mike at DeleteThis.Geary.com> wrote in message
news:vlo9699d77sj3e at corp.supernews.com...
> > Andrew Chalk wrote:
> > > Is there a python equivalent of the C ternery operator?
>
> Peter Hansen wrote:
> > See http://www.python.org/cgi-bin/faqw.py?query=4.16&req=search
>
> As a newcomer to Python, I found it interesting to read the PEP for this:
>
> http://www.python.org/peps/pep-0308.html
>
> In retrospect, it seems obvious that the way the voting was conducted
> insured that no ternary operator would be added to the language.

I absolutely concur. In fact, I thought that as soon as the voting style
was proposed.

> There were 16 proposed syntax options, and the requirement was that a
> ternary operator would be added only if an clear majority picked a single
> one of those options.

I don't believe that was the case originally. I think the idea of
enumerating
suggestions and having a vote came later.

> Well, with 16 options to choose from, it hardly seems surprising that none
> achieved a majority-even though several of them drew quite a few votes,
and
> the most popular proposal did get more votes than the "reject all" option.

Yup.

> Four of the options got significantly more votes than the others. Those
four
> options combined got more than three times the number of votes that
"reject
> all" got.

In other words, there was a super-majority to get something in.

> It seems to me that the majority did want some kind of ternary operator,
but
> the large number of options prevented any one from being the clear winner.
I
> would wager that if the BDFL had picked his favorite from any of the most
> popular options and said, "Now vote yes or no on *this* syntax", he would
> have seen that clear majority he was looking for.

I agree. In fact, unless the syntax was truely awful, I'd have voted for it,
whatever it was. I don't regard myself as a language designer.

> I suppose this is all water under the bridge now, since the PEP stated
that
> this was the community's one and only chance. I just can't help but think
> that the voting system guaranteed the outcome--but it's Guido's language
and
> it was certainly his call to make.

I wouldn't cast the blame on Guido. It's quite clear that he doesn't
like the notion, but I don't get the impression that he's got the kind
of devious mind that would think this was the way to resolve it.
On the contrary, he seems to be a quite straightforward fellow in
most ways.

The whole notion of "one and only chance" is astonishingly naive.
There is no way that the vote on PEP 308 is going to keep people
from bring up the idea, and having the opponents refer to it as the
"community decision" when the vote was clearly in favor of having
the feature added to the language will simply drive people away
from the process.

> -Mike (who just got my California voter's pamphlet with 135 candidates for
> governor!)

Interesting thought there...

John Roth
>
>






More information about the Python-list mailing list