Ethan Furman wrote:
On 02/21/2014 03:29 PM, Greg Ewing wrote:
value = lst[2] 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?
Hmmm, probably not very well, unless we define
a except b if E1 except c if E2
to mean
a except (b except c if E2) if E1
If E1 == E2, that could perhaps be abbreviated to
a except b except c if E
Or we could just decide that the nested case is going
to be so rare it's not worth worrying about.