A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2006-March/062504.html below:

[Python-Dev] Py3k: Except clause syntax

[Python-Dev] Py3k: Except clause syntax [Python-Dev] Py3k: Except clause syntaxFuzzyman fuzzyman at voidspace.org.uk
Fri Mar 17 10:08:26 CET 2006
Michael Hudson wrote:
> skip at pobox.com writes:
>
>   
>>     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.
>>     
>
>   

Wasn't the proposal :

try:
    something
except NameError, OtherError as e:
    something...

?

With e being bound for any of the exceptions...

Michael Foord

> except TypeError or KeyError as msg: !
>
> not-serious-ly y'rs,
> mwh
>
>   

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/python-dev/attachments/20060317/69155b7e/attachment.html 
More information about the Python-Dev mailing list

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