[Python-ideas] exception based conditional expression, similar to if-else conditional expression
rrr at ronadam.com
Sat Aug 22 21:53:33 CEST 2009
Ron Adam wrote:
> Steven D'Aprano wrote:
>> Words are just symbols, so anytime you have syntax including a
>> keyword, you could replace the keyword with a symbol. That way leads
>> to APL. As a general rule, keywords are more readable, punctuation is
>> more concise.
> Yes, I agree, but python isn't that strict about everything. To me a
> well defined exception expression that
Editing fragment... Disregard the incomplete sentence.
> All the previous suggestions view the term as needing three values, so
> you need two separators along with unique symbols (or keywords) to come
> up with something that fits the need in a clear and concise way. I was
> thinking what if we could use the exception object itself as an
> operator, then the term becomes even simpler and more concise. But the
> only way I can think to do that in a clear way is to use syntax to
> identify the exception, such as putting colons, or some other symbol
> around the exception. <shrug>
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.
More information about the Python-ideas