<div class="gmail_quote">On 14 September 2012 02:52, Stephen J. Turnbull <span dir="ltr"><<a href="mailto:stephen@xemacs.org" target="_blank">stephen@xemacs.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Terry Reedy writes:<br>
<br>
 > try:<br>
 >    try:<br>
<br>
Ugh-ugh.<0.5 wink><br>
<div class="im"><br>
 > try:<br>
 >      operation()<br>
 > except Exception as err:<br>
 >      if isinstance(err, IOError) and err.errno == 2:<br>
<br>
</div>Ugh.<0.5 wink><br>
<br>
Not your fault, but these constructions are pretty ugly IMO, I have to<br>
go with the OP on that.<br>
<br>
ISTR there were discussions of "qualified except" clauses here maybe<br>
6mo to 1yr ago?  That is, they'd look something like<br>
<div class="im"><br>
try:<br>
     operation()<br>
except IOError as err if err.errno == 2:<br>
     do_something()<br>
</div>except Exception:<br>
<div class="im">     logger.error("Error performing operation: {}".format(err.message)")<br>
     some_clean_up()<br>
     raise<br>
<br>
</div>Again ISTR that this got spiked for some reason, but maybe it will be<br>
of use to the OP in formulating his next idea.  Sorry for the lack of<br>
precise reference.<br></blockquote><div><br></div><div>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)</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="HOEnZb"><div class="h5">_______________________________________________<br>
Python-ideas mailing list<br>
<a href="mailto:Python-ideas@python.org">Python-ideas@python.org</a><br>
<a href="http://mail.python.org/mailman/listinfo/python-ideas" target="_blank">http://mail.python.org/mailman/listinfo/python-ideas</a><br>
</div></div></blockquote></div><br>