Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > anything new on the ternary operator?

Thread Tools

anything new on the ternary operator?

Posts: n/a
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?

Reply With Quote
Sean Ross
Posts: n/a
From Guido's EuroPython 2003 "State of the Python Union" slides

Conditional Expressions
- Vote in March
- (if C: x else: y) won the vote
- But not by a landslide
- Now in Filibuster mode
- When in doubt, don't change it
- Competing forces:
- feature bloat
- handy feature

Reply With Quote
Posts: n/a
(if C: x else: z)

Was this the winning syntax? I think I saw it somewhere without the
parentheses, in something written by GvR. This syntax would have been great
without the parentheses. A bit messy with them, especially when they really
don't add any readability, like this
return if C1: x elif C2: y else: z

Why are the parentheses neccessary (and are they really)?

Reply With Quote
Erik Max Francis
Posts: n/a
Tor wrote:

> (if C: x else: z)
> Was this the winning syntax?

Best way to answer this is to just read PEP 308:

Erik Max Francis && Removed) &&
__ San Jose, CA, USA && 37 20 N 121 53 W && &tSftDotIotE
/ \ To be adult is to be alone.
\__/ Jean Rostand
Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
anything whcih can be done with ternary but not with if else C++ 24 10-19-2005 12:43 PM
generator expressions and new ternary operator zipher Python 2 09-13-2004 07:02 AM
ternary trouble in datalist/repeater Darren ASP .Net 2 08-13-2004 04:12 PM
Re: anything new on the ternary operator? Bob Gailer Python 16 07-08-2003 10:50 PM
Re: anything new on the ternary operator? John Hunter Python 1 07-07-2003 05:31 PM