<br><br><div class="gmail_quote">2009/10/2 Arnaud Delobelle <span dir="ltr"><<a href="mailto:arnodel@googlemail.com">arnodel@googlemail.com</a>></span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="im"><br>
On 2 Oct 2009, at 15:43, Steven D'Aprano wrote:<br>
<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
Perhaps there should be. Does anyone know why there isn't? It seems an<br>
arbitrary restriction to me, because the following pieces of code are<br>
not equivalent:<br>
<br>
# not currently legal<br>
try:<br>
   if cond:<br>
       raise ValueError<br>
else:<br>
   print "no exception was raised"<br>
finally:<br>
   print "done"<br>
<br>
<br>
</blockquote></div>
But the above is the same as:<div class="im"><br>
<br>
try:<br>
    if cond:<br>
       raise ValueError<br></div><div class="im">
    print "no exception was raised"<br>
finally:<br>
    print "done"<br>
<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
versus:<br>
</blockquote></div>
[...]<br>
<br></blockquote><div><br>But as always with Python, the code in the else clause is not protected by the except so that you do not incorrectly handle unexpected exceptions.<br><br>Michael<br> </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

-- <br><font color="#888888">
Arnaud</font><div><div></div><div class="h5"><br>
<br>
<br>
_______________________________________________<br>
Python-ideas mailing list<br>
<a href="mailto:Python-ideas@python.org" target="_blank">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><br clear="all"><br>-- <br><a href="http://www.ironpythoninaction.com/">http://www.ironpythoninaction.com/</a><br><br><br>