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/132833.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
Thu Feb 27 20:55:24 CET 2014
On Fri, Feb 28, 2014 at 6:36 AM, Glenn Linderman <v+python at g.nevcal.com> wrote:
> +1
>
>     f() except ((TypeError, AttributeError): "No value")
>
> is a nice extension to the idea of
>
>     value = expr except (
>         Exception1: default1,
>         Exception2: default2,
>         Exception3: default3,
>    )
>
> Which I've liked since I first saw it, as it neatly solves handling multiple
> except clauses.

You can already list multiple exception types. The definition of the
exception_list is exactly as per the try/except statement (bar the
'as' keyword, which I would love to see implemented some day).

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