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/062494.html below:

[Python-Dev] Py3k: Except clause syntax

[Python-Dev] Py3k: Except clause syntax [Python-Dev] Py3k: Except clause syntaxRon Adam rrr at ronadam.com
Fri Mar 17 04:32:54 CET 2006
Greg Ewing wrote:
> Baptiste Carvello wrote:
> 
>> what about
>>
>>      except <type> with <value>:
>>
>> a program dies "with" an error message, not "as" an error message.
> 
> No. The exception object you're catching *is* the value,
> not something which *has* a value. I maintain that "as"
> is the correct word to use here.
> 
> Greg

I think it reads well with "as" also.  +1

To me it's a filter statement.  So would catching multiple exceptions 
have the form:

       except (<type>, <type>) as <name>:

The value is bound to the name if it's type is in the sequence.  This 
would be an indirect assignment similar to.

       if value in list: name = value

Which you can't do directly because you don't have access to the value 
yet.  That's not too different than import which is also an indirect 
name binding operation of a value you don't have yet.

Cheers,
    Ron

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