Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Python (http://www.velocityreviews.com/forums/f43-python.html)
-   -   Re: anything new on the ternary operator? (http://www.velocityreviews.com/forums/t319322-re-anything-new-on-the-ternary-operator.html)

Bob Gailer 07-06-2003 11:19 PM

Re: anything new on the ternary operator?
 
At 10:59 PM 7/6/2003 +0200, Tor wrote:

>What's the current status on the ternary operator that may or may not be
>added to python. Haven't heard much about that since the vote was announced
>for a couple of months ago. What's the best way to follow that dicussion?
>Or are we just waiting for the developers to make their decision?


Last I heard it was killed by Guido, which makes me wonder why we spent so
much time discussing and voting. If he did not want it I wish he had killed
it at the start. I thought the vote was to determine the best choice, and I
was looking forward to having it.

<grumble>Makes me wonder about the whole PEP process. Why bother! </grumble>

Bob Gailer
bgailer@alum.rpi.edu
303 442 2625


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.492 / Virus Database: 291 - Release Date: 6/24/2003


Aahz 07-07-2003 12:16 AM

Re: anything new on the ternary operator?
 
In article <mailman.1057533670.9800.python-list@python.org>,
Bob Gailer <bgailer@alum.rpi.edu> wrote:
>At 10:59 PM 7/6/2003 +0200, Tor wrote:
>>
>>What's the current status on the ternary operator that may or may not
>>be added to python. Haven't heard much about that since the vote was
>>announced for a couple of months ago. What's the best way to follow
>>that dicussion? Or are we just waiting for the developers to make
>>their decision?

>
>Last I heard it was killed by Guido, which makes me wonder why we spent
>so much time discussing and voting. If he did not want it I wish he had
>killed it at the start. I thought the vote was to determine the best
>choice, and I was looking forward to having it.


Guido made clear before the vote that only a clear statement from the
community would drive the addition of the ternary operator. Given that
the vote did not present a clear result, he did what he said he'd do.
How's that a prbolem?
--
Aahz (aahz@pythoncraft.com) <*> http://www.pythoncraft.com/

"Not everything in life has a clue in front of it...." --JMS

Russell Reagan 07-07-2003 02:13 AM

Re: anything new on the ternary operator?
 
"Bob Gailer" <bgailer@alum.rpi.edu> wrote

> I was looking forward to having it.


"Sean Ross" <sross@connectmail.carleton.ca> wrote

> - (if C: x else: y) won the vote


I'm still learning python, so don't flame too much :-)

What is superior about using the proposed ternary operator instead of using
the 'and' and 'or' operators to simulate inline logic?



Ben Finney 07-07-2003 02:35 AM

Re: anything new on the ternary operator?
 
On Mon, 07 Jul 2003 02:13:15 GMT, Russell Reagan wrote:
> What is superior about using the proposed ternary operator instead of
> using the 'and' and 'or' operators to simulate inline logic?


The "cond and expr1 or expr2" does not always function as expected for a
ternary if-then-else operator. The PEP for the ternary operator
explains:

"A common way to emulate an if-then-else expression is:

<condition> and <expression1> or <expression2>

However, this doesn't work the same way: it returns <expression2>
when <expression1> is false! See FAQ 4.16 for alternatives that
work -- however, they are pretty ugly and require much more effort
to understand."
<http://www.python.org/peps/pep-0308.html>

FAQ 4.16 is here:
<http://www.python.org/cgi-bin/faqw.py?req=show&file=faq04.016.htp>

--
\ "I wish I had a dollar for every time I spent a dollar, because |
`\ then, yahoo!, I'd have all my money back." -- Jack Handey |
_o__) |
http://bignose.squidly.org/ 9CFE12B0 791A4267 887F520C B7AC2E51 BD41714B

Erik Max Francis 07-07-2003 02:36 AM

Re: anything new on the ternary operator?
 
Russell Reagan wrote:

> What is superior about using the proposed ternary operator instead of
> using
> the 'and' and 'or' operators to simulate inline logic?


Because the and/or technique doesn't quite work. Instead of rehashing
this topic again, I'd recommend you check out the PEP 308 on the
conditional operator which goes through all the details:

http://www.python.org/peps/pep-0308.html

--
Erik Max Francis && max@alcyone.com && http://www.alcyone.com/max/
__ San Jose, CA, USA && 37 20 N 121 53 W && &tSftDotIotE
/ \ She glanced at her watch ... It was 9:23.
\__/ James Clavell

Peter Hansen 07-07-2003 03:00 AM

Re: anything new on the ternary operator?
 
Bob Gailer wrote:
>
> Last I heard it was killed by Guido, which makes me wonder why we spent so
> much time discussing and voting. If he did not want it I wish he had killed
> it at the start. I thought the vote was to determine the best choice, and I
> was looking forward to having it.
>
> <grumble>Makes me wonder about the whole PEP process. Why bother! </grumble>


From the PEP (http://python.org/peps/pep-0308.html) :

This is the community's one chance: if this PEP is approved with a clear
majority, it will be implemented in Python 2.4. ... If the community can't
decide, the BDFL will reject the PEP.

Also, reading PEP 1 "PEP Purpose and Guidelines", I see nothing in there to
suggest that the process was not followed, and lots of things that point out
that the BDFL's ruling is still the only thing that matters, in the end.
Those dissenting will be required to start their own fork of Python, then
shot. ;-)

PEP 1 also answers your question about "why we spent so much time discussing
and voting"...

-Peter

Andreas Jung 07-07-2003 05:16 AM

Re: anything new on the ternary operator?
 


--On Montag, 7. Juli 2003 2:13 Uhr +0000 Russell Reagan <rreagan@attbi.com>
wrote:

> "Bob Gailer" <bgailer@alum.rpi.edu> wrote
>
>> I was looking forward to having it.

>
> "Sean Ross" <sross@connectmail.carleton.ca> wrote
>
>> - (if C: x else: y) won the vote

>
> I'm still learning python, so don't flame too much :-)
>
> What is superior about using the proposed ternary operator instead of
> using the 'and' and 'or' operators to simulate inline logic?


Please stop the discussion. The ternary operator is dead (which is a very
good thing)
because GvR made the decision.

-aj


Paul Rudin 07-07-2003 09:42 AM

Re: anything new on the ternary operator?
 
>>>>> "Aahz" == Aahz <aahz@pythoncraft.com> writes:

> Guido made clear before the vote that only a clear statement
> from the community would drive the addition of the ternary
> operator. Given that the vote did not present a clear result,
> he did what he said he'd do. How's that a prbolem?


I don't know the details of this process; but personally I think a
ternary operator would be a very good thing - and don't care about the
syntax too much. Maybe the right think to vote on was simply a yes/no
to "Do you want a ternary operator?".

Maybe the problem is perhaps that disagreement over the competing
syntactical suggestions obscures the fact that a majority would prefer
to see some ternary operator rather than none?

Moshe Zadka 07-07-2003 10:47 AM

Re: anything new on the ternary operator?
 
On Mon, 07 Jul 2003, Erik Max Francis <max@alcyone.com> wrote:

> Bob's phrasing of it was obviously overly confrontational, but I do find
> it at least a little unfortunate that the final decision on PEP 308 only
> came indirectly (meaning not as any form of widespread public
> announcement, but rather as a side point in a presentation at a local
> conference)


I'm sorry, I was going to let this slide by, but this comment made it
impossible. How the hell do you figure EuroPython, the biggest Python
conference in Europe and largely equivalent to the size of PyCon, is a
"local" conference?

By and large, I think EuroPython holds half the heritage of the venerable
IPCs, being way more international than PyCon. Announcements of new
developments are often done at conferences, especially the larger ones.
It has been said multiple times that Guido is likely to make an announcement
in EuroPython, and it was pretty easy to get the answer out on c.l.py soon
afterwards. While the PEP will eventually be updated, I am glad Guido thought
it was a higher priority to get 2.3b2 out the door in the little time he had
between EP and OSCON.

> There isn't a problem that PEPs and such voting processes are worthless
> -- obviously the BDFL has the final say -- but perhaps it would have
> been a little nicer to get an official position on the subject earlier.


Guido said that he wanted to let the discussion simmer down before he made
an official pronouncement. He also *did* consider the vote: if you remember,
there were a few interpretations. Guido chose the one who enforced
Condorset(sp?) semantics on the results, an arguably sane position considering
other free software projects use this voting method. According to this
interpretation, the vote resulted in "don't change".

--
Moshe Zadka -- http://moshez.org/
Buffy: I don't like you hanging out with someone that... short.
Riley: Yeah, a lot of young people nowadays are experimenting with shortness.
Agile Programming Language -- http://www.python.org/


Lulu of the Lotus-Eaters 07-07-2003 04:34 PM

Re: anything new on the ternary operator?
 
Moshe Zadka <m@moshez.org> wrote previously:
|I'm sorry, I was going to let this slide by, but this comment made it
|impossible. How the hell do you figure EuroPython, the biggest Python
|conference in Europe and largely equivalent to the size of PyCon, is a
|"local" conference?

Yeah, but Donald Rumsfeld has let us 'merkins know that Old Europe is
now irrelevant. What could be more clear?

--
mertz@ | The specter of free information is haunting the `Net! All the
gnosis | powers of IP- and crypto-tyranny have entered into an unholy
..cx | alliance...ideas have nothing to lose but their chains. Unite
| against "intellectual property" and anti-privacy regimes!
-------------------------------------------------------------------------




All times are GMT. The time now is 12:47 AM.

Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57