[Python-Dev] PEP 463: Exception-catching expressions
ethan at stoneleaf.us
Sat Feb 22 00:38:01 CET 2014
On 02/21/2014 03:29 PM, Greg Ewing wrote:
> Antoine Pitrou wrote:
>>> lst = [1, 2]
>>> value = lst except IndexError: "No value"
>> the gain in concision is counterbalanced by a loss in
> This version might be more readable:
> value = lst except "No value" if IndexError
It does read nicely, and is fine for the single, non-nested, case (which is probably the vast majority), but how would
it handle nested exceptions?
More information about the Python-Dev