On Sat, 22 Feb 2014 02:12:04 +1100
Chris Angelico <ros...@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.


_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to