[Python-ideas] syntax to continue into the next subsequent except block
Stephen J. Turnbull
stephen at xemacs.org
Fri Sep 14 03:52:39 CEST 2012
More information about the Python-ideas mailing list
Fri Sep 14 03:52:39 CEST 2012
- Previous message: [Python-ideas] syntax to continue into the next subsequent except block
- Next message: [Python-ideas] syntax to continue into the next subsequent except block
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Terry Reedy writes:
> try:
> try:
Ugh-ugh.<0.5 wink>
> try:
> operation()
> except Exception as err:
> if isinstance(err, IOError) and err.errno == 2:
Ugh.<0.5 wink>
Not your fault, but these constructions are pretty ugly IMO, I have to
go with the OP on that.
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.
- Previous message: [Python-ideas] syntax to continue into the next subsequent except block
- Next message: [Python-ideas] syntax to continue into the next subsequent except block
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-ideas mailing list