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/) _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com