[Python-ideas] exception based conditional expression, similar to if-else conditional expression

Carl Johnson cmjohnson.mailinglist at gmail.com
Sun Aug 23 00:23:04 CEST 2009

Ron Adam wrote:

> An additional note, the when you view an exception object in the console it
> is bracketed by the less than and and greater than signs.  Maybe there is a
> way to use those in a manner that is consistent with the string repr()
> returns.

There won't be unless you rule out using "x > y" as an expression that
gives the default value. But doing that will make Python's grammar way
too complicated, and you're still left with the problem of "x, y = a <
b, b > c" which is legal today.

It's my understanding that Ruby has run into a lot of ambiguity with
its use of | as both a bitwise operator and a part of a block
definition. This seems worse.

More information about the Python-ideas mailing list