On Fri, Sep 14, 2012 at 11:52 AM, Stephen J. Turnbull <stephen@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. Cheers, Nick. -- Nick Coghlan | ncoghlan@gmail.com | Brisbane, Australia