
After a long discussion I've decided to add a shortcut conditional expression to Python 2.5. The syntax will be A if C else B This first evaluates C; if it is true, A is evaluated to give the result, otherwise, B is evaluated to give the result. The priorities will be such that you can write x = A if C else B x = lambda: A if C else B x = A if C else B if D else E But you'd have to write if (A if C else B): [x for x in seq if (A if C else B)] A if (X if C else Y) else B (A if C else B) if D else E Note that all these are intentionally ugly. :) In general, 'if' and 'else' bind less tight than everything except lambda. We will adjust the syntax of what goes inside an 'if' to disallow lambda; currently if lambda: x: is accepted but quite useless (it's always true) so this will be disallowed. Flames, pleas to reconsider, etc., to /dev/null. Congratulations gracefully accepted. It's still my language! :-) -- --Guido van Rossum (home page: http://www.python.org/~guido/)

On 9/29/05, Guido van Rossum <guido@python.org> wrote:
Flames, pleas to reconsider, etc., to /dev/null.
Congratulations gracefully accepted.
It's still my language! :-)
I don't like those options. :-) How about this: Can someone update the PEP on conditional expressions to point to this email and update the status, etc? Thanks, n

On 9/29/05, Guido van Rossum wrote:
After a long discussion I've decided to add a shortcut conditional expression to Python 2.5.
The syntax will be
A if C else B
[snip]
Congratulations gracefully accepted.
Congratulations, and many thanks for making this decision before the threads leaked into the next summary period. ;-) STeVe -- You can wordify anything if you just verb it. --- Bucky Katt, Get Fuzzy

Guido van Rossum wrote: ...
Flames, pleas to reconsider, etc., to /dev/null.
Congratulations gracefully accepted.
Congratulations for a clear decision! Personally, I would have preferred a "no, never in my life" alternative response slightly more, but a clear say is better than endless discussions about something as relevant as syntax. My canned reply, tailored to fit into the set of accepted answers reduces to "Thank you so much :-) ".
It's still my language! :-)
Self-inconfidence alert! You would never need to say this if you not felt like a bot. Please shut down and get adjusted. Guidos don't say that. :-) -- Christian Tismer :^) <mailto:tismer@stackless.com> tismerysoft GmbH : Have a break! Take a ride on Python's Johannes-Niemeyer-Weg 9A : *Starship* http://starship.python.net/ 14109 Berlin : PGP key -> http://wwwkeys.pgp.net/ work +49 30 802 86 56 mobile +49 173 24 18 776 fax +49 30 80 90 57 05 PGP 0x57F3BF04 9064 F4E1 D754 C2FF 1619 305B C09C 5A3B 57F3 BF04 whom do you want to sponsor today? http://www.stackless.com/

Guido van Rossum wrote:
Congratulations gracefully accepted.
Hurrah! Cheers, Nick. -- Nick Coghlan | ncoghlan@gmail.com | Brisbane, Australia --------------------------------------------------------------- http://boredomandlaziness.blogspot.com

On 9/30/05, Guido van Rossum <guido@python.org> wrote:
Flames, pleas to reconsider, etc., to /dev/null.
No flames from here.
Congratulations gracefully accepted.
Consider them supplied. For both your patience, and for supplying the decision we all desperately needed.
It's still my language! :-)
It always was :-) And just to prove it, we ended up with your original instinct after all... Paul.

On Thu, 2005-09-29 at 21:21, Guido van Rossum wrote:
Flames, pleas to reconsider, etc., to /dev/null.
Congratulations gracefully accepted.
It's still my language! :-)
Congratulations! May this be as successful a syntax addition as decorators and print>> (of which I'm a fan too! :). -Barry

Barry Warsaw wrote:
On Thu, 2005-09-29 at 21:21, Guido van Rossum wrote:
Flames, pleas to reconsider, etc., to /dev/null.
Congratulations gracefully accepted.
It's still my language! :-)
Congratulations! May this be as successful a syntax addition as decorators and print>> (of which I'm a fan too! :).
I have to say, now Guido is getting rid of print>> along with the rest of the print statement I have become nostalgically fond of it. Perhaps it's just that I can't help siding with the underdog, doomed for the knacker's yard in Python 3.0. Sniff. The decision on X if C else Y is a cause for much jubilation. Congratulations, Guido! nothing-to-see-here-folks-let's-move-along-ly y'rs - steve -- Steve Holden +44 150 684 7255 +1 800 494 3119 Holden Web LLC www.holdenweb.com PyCon TX 2006 www.python.org/pycon/

[Guido]
After a long discussion I've decided to add a shortcut conditional expression to Python 2.5.
The syntax will be
A if C else B
...
The priorities will be such that you can write
... x = A if C else B if D else E
I assume this groups as A if C else (B if D else E) rather than as (A if C else B) if D else E ? So that C is evaluated first, and if C is true D isn't evaluated at all. ...
Flames, pleas to reconsider, etc., to /dev/null.
Compared to the postfix A then C if B it's a positive delight.
Congratulations gracefully accepted.
Congratulations gracefully tendered.
It's still my language! :-)
If that was in doubt, you just proved it <wink>.

On 9/29/05, Guido van Rossum <guido@python.org> wrote: [SNIP]
Flames, pleas to reconsider, etc., to /dev/null.
Congratulations gracefully accepted.
And gladly given! All proposals should be resolved this cleanly in the end.
It's still my language! :-)
Yes it is, thank goodness! -Brett
participants (11)
-
Barry Warsaw
-
Brett Cannon
-
Christian Tismer
-
Guido van Rossum
-
Neal Norwitz
-
Nick Coghlan
-
Paul Moore
-
Raymond Hettinger
-
Steve Holden
-
Steven Bethard
-
Tim Peters