Showing content from http://mail.python.org/pipermail/python-dev/attachments/20060317/69155b7e/attachment.html below:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Michael Hudson wrote:
<blockquote cite="mid2m3bhh30fu.fsf@starship.python.net" type="cite">
<pre wrap=""><a class="moz-txt-link-abbreviated" href="mailto:skip@pobox.com">skip@pobox.com</a> writes:
</pre>
<blockquote type="cite">
<pre wrap=""> Greg> except <type> as <value>:
Baptiste> except <type> with <value>:
Can I catch multiple exceptions with a single value in this case? Today, I
write:
try:
foo()
except (TypeError, KeyError), msg:
print msg
Either of the above seem like they'd require me to repeat the value, e.g:
try:
foo()
except TypeError with msg, KeyError with msg:
print msg
Not very Pythonic methinks.
</pre>
</blockquote>
<pre wrap=""><!---->
</pre>
</blockquote>
<br>
Wasn't the proposal :<br>
<br>
try:<br>
something<br>
except NameError, OtherError as e:<br>
something...<br>
<br>
?<br>
<br>
With e being bound for any of the exceptions...<br>
<br>
Michael Foord<br>
<br>
<blockquote cite="mid2m3bhh30fu.fsf@starship.python.net" type="cite">
<pre wrap="">except TypeError or KeyError as msg: !
not-serious-ly y'rs,
mwh
</pre>
</blockquote>
<br>
</body>
</html>
RetroSearch is an open source project built by @garambo
| Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4