[Python-ideas] syntax to continue into the next subsequent except block
tjreedy at udel.edu
Mon Sep 17 08:29:06 CEST 2012
On 9/16/2012 8:11 PM, Greg Ewing wrote:
> Guido van Rossum wrote:
>> The suggestion to add ad-hoc "if <condition>" clauses to random parts
>> of the syntax doesn't appeal to me at all.
> I wouldn't call it a random part of the syntax. This is
> not like the proposals to add if-clauses to while loops,
> for loops, etc -- they would just be minor syntactic sugar.
> This proposal addresses something that is quite awkward to
> express using existing constructs.
I see it as quite similar. The proposal is to lift conditions out of the
body of a compound statement and put them in the header.
There is always the option to catch everything in one except statement
and conditionally process or re-raise as desired. Having all exceptions
be instances of named subclasses of one baseclass makes this easier than
when exceptions were strings.
Terry Jan Reedy
More information about the Python-ideas