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/2014-February/132757.html below:

[Python-Dev] PEP 463: Exception-catching expressions

[Python-Dev] PEP 463: Exception-catching expressions [Python-Dev] PEP 463: Exception-catching expressionsChris Angelico rosuav at gmail.com
Tue Feb 25 01:42:29 CET 2014
On Tue, Feb 25, 2014 at 11:27 AM, Jim J. Jewett <jimjjewett at gmail.com> wrote:
> This also makes me wonder whether the cost of a subscope
> (for exception capture) could be limited to when an
> exception actually occurs, and whether that might lower
> the cost enough to make the it a good tradeoff.
>
>     def myfunc1(a, b, e):
>         assert "main scope e value" == e
>
>     e = "main scope e value"
>     value = (myfunc1(val1, val2, e)
>               except e.reason if AppError as e)
>     assert "main scope e value" == e

I'm sure it could. But there aren't many use-cases. Look at the one
example I was able to find in the stdlib:

http://legacy.python.org/dev/peps/pep-0463/#capturing-the-exception-object

It's hardly a shining example of the value of the proposal. Got any
really awesome demo that requires 'as'? Most of the supporting
examples use something like KeyError where it's simply "was an
exception thrown or not".

ChrisA
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