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

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

[Python-Dev] PEP 463: Exception-catching expressions [Python-Dev] PEP 463: Exception-catching expressionsAntoine Pitrou solipsis at pitrou.net
Fri Feb 21 17:18:30 CET 2014
On Sat, 22 Feb 2014 02:12:04 +1100
Chris Angelico <rosuav at gmail.com> wrote:
> 
> Overbroad exception handling comes in two ways. One is simply catching
> Exception or BaseException when a narrower class would be better, and
> that's not addressed by this PEP (except insofar as it does not have a
> bare "except:" syntax, and so it forces you to at least be explicit
> about catching BaseException). The other is this:
> 
> try:
>     f(x[i])
> except IndexError:
>     f(default)
> 
> Translating that into this form:
> 
> f(x[i] except IndexError: default)
> 
> means that an IndexError thrown inside f() will not be caught.

Thank you and Nick for the explanation. This is a good point.
I'm still put off by the syntax, though, just like Brett.

Regards

Antoine.


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