[Python-ideas] syntax to continue into the next subsequent except block

Greg Ewing greg.ewing at canterbury.ac.nz
Fri Sep 14 02:26:59 CEST 2012

Paul Wiseman wrote:
> try:
>     operation()
> except IOError as err:
>     if err.errno == 2:
>         do_something()
>     else:
>         continue #This would continue the except down to the next check,

I think a better way to address this would be to allow guard
expressions on the except clauses.

    except IOError as err if err.errno == 2:


More information about the Python-ideas mailing list