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

Nick Coghlan ncoghlan at gmail.com
Fri Sep 14 04:32:04 CEST 2012

On Fri, Sep 14, 2012 at 11:52 AM, Stephen J. Turnbull
<stephen at xemacs.org> wrote:
> ISTR there were discussions of "qualified except" clauses here maybe
> 6mo to 1yr ago?  That is, they'd look something like
> try:
>      operation()
> except IOError as err if err.errno == 2:
>      do_something()
> except Exception:
>      logger.error("Error performing operation: {}".format(err.message)")
>      some_clean_up()
>      raise
> Again ISTR that this got spiked for some reason, but maybe it will be
> of use to the OP in formulating his next idea.  Sorry for the lack of
> precise reference.

They were one of the ideas discussed when Antoine was writing PEP
3151. As I recall, nobody could think of any good use cases that
didn't involve errno checking, and PEP 3151 provides a far more
elegant (and cross-platform) solution to most problems that require
errno checking in versions prior to 3.3.


Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia

More information about the Python-ideas mailing list