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

Tim Delaney timothy.c.delaney at gmail.com
Fri Feb 21 21:33:20 CET 2014

On 22 February 2014 02:03, Chris Angelico <rosuav at gmail.com> wrote:

> Oops, hit the wrong key and sent that half-written.
> ... and simply require that the statement form be used. But the
> whelming opinion of python-dev seems to be in favour of the parens
> anyway, and since they give us the possibility of future expansion
> effectively for free, I've gone that way. Parens are now required; the
> syntax is:
> value = (expr except Exception: default)

Let me add my congratulations on a fine PEP.

I think it's much more readable with the parens (doesn't look as much like
there's a missing newline). I'd also strongly argue for permanently
disallowing multiple exceptions - as you said, this is intended to be a
simple, readable syntax.

Even with the parens, I share the bad gut feeling others are having with
the colon in the syntax. I also don't think "then" is a good fit (even if
it didn't add a keyword).

Unfortunately, I can't come up with anything better ...

Tim Delaney
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20140222/a1f8fa33/attachment.html>

More information about the Python-Dev mailing list