<div class="gmail_quote">On 14 September 2012 03:32, Nick Coghlan <span dir="ltr"><<a href="mailto:ncoghlan@gmail.com" target="_blank">ncoghlan@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">On Fri, Sep 14, 2012 at 11:52 AM, Stephen J. Turnbull<br>
<<a href="mailto:stephen@xemacs.org">stephen@xemacs.org</a>> wrote:<br>
> ISTR there were discussions of "qualified except" clauses here maybe<br>
> 6mo to 1yr ago? That is, they'd look something like<br>
><br>
> try:<br>
> operation()<br>
> except IOError as err if err.errno == 2:<br>
> do_something()<br>
> except Exception:<br>
> logger.error("Error performing operation: {}".format(err.message)")<br>
> some_clean_up()<br>
> raise<br>
><br>
> 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>
<br>
</div>They were one of the ideas discussed when Antoine was writing PEP<br>
3151. As I recall, nobody could think of any good use cases that<br>
didn't involve errno checking, and PEP 3151 provides a far more<br>
elegant (and cross-platform) solution to most problems that require<br>
errno checking in versions prior to 3.3.<br>
<br></blockquote><div><br></div><div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">Ah I didn't know about that, maybe I chose a bad example with IOError.</div>
<div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)"><br></div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">
The reason that got me thinking is I had to handle specific S3ResponseErrors from boto.</div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)"><br></div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">
the S3ResponseError exception class has a code attribute (or errorcode, i forget exactly).</div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)"><br></div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">
Surely in this case and a lot of other modules different exceptions are grouped together that are likely to want to be handle differently?<br></div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">
<br></div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">URLError and HTTPError I'm sure fall into this catagory</div></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Cheers,<br>
Nick.<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
Nick Coghlan | <a href="mailto:ncoghlan@gmail.com">ncoghlan@gmail.com</a> | Brisbane, Australia<br>
</font></span><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>