On 15/09/2012 09:21, Paul Wiseman wrote:
On 14 September 2012 02:52, Stephen J. Turnbull <stephen@xemacs.org <mailto:stephen@xemacs.org>> wrote:
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.
I like that "qualified except". Almost goes without saying it's a much better idea/solution that my idea of a continue (which has already pointed out to be flawed- I'm not sure why now I thought it was always a syntax error) I really like this qualified except! It's meaning is intuitively obvious - AND it's useful. Rob Cliffe
_______________________________________________ Python-ideas mailing list Python-ideas@python.org <mailto:Python-ideas@python.org> http://mail.python.org/mailman/listinfo/python-ideas
_______________________________________________ Python-ideas mailing list Python-ideas@python.org http://mail.python.org/mailman/listinfo/python-ideas