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

Greg Ewing greg.ewing at canterbury.ac.nz
Fri Aug 21 00:12:45 CEST 2009

Steven D'Aprano wrote:

> Others have suggested that the colon should be dropped. I dislike that 
> idea, because there's nothing but whitespace delimiting the list of 
> exceptions from the except-expression:

I agree. Even if it can be parsed unambiguously, it's
going to seem weird and confusing to a human.

So far I haven't seen anything I like better than

   <expr> except <value> if <exception>

despite the fact that it uses the words 'except'
and 'if' in a different way than elsewhere.


More information about the Python-ideas mailing list