[Python-ideas] except expression

Chris Angelico rosuav at gmail.com
Wed Feb 19 16:16:54 CET 2014


On Thu, Feb 20, 2014 at 1:03 AM, Nick Coghlan <ncoghlan at gmail.com> wrote:
> Since dropping the optional "as" clause drastically simplifies the
> proposal (no need for a hidden scope), and the use case for it isn't
> at all compelling, that puts it in the "don't bother" category for me.

In the light of comments like this, I've deferred the 'as' clause, and
also everything involving multiple except clauses. The proposal is now
simply:

    expr except exception_list: default

with straight-forward semantics. It can easily be extended in future.

I've also added a whole bunch of examples, lifted from the separate
examples.py. Note that the word "chain" no longer appears in the
proposal; it's simply "multiple except clauses". Having a term for it
is more useful when it's a part of the proposal; since it's deferred
anyway, that's not a big deal.

Latest version, as always, is here:

https://raw2.github.com/Rosuav/ExceptExpr/master/pep-0463.txt

Additional examples, with syntax highlighting:

https://github.com/Rosuav/ExceptExpr/blob/master/examples.py

Please let me know if I've made any glaring errors (even trivial ones
like typos). Lots of editing has happened recently, and several times
I discovered that I'd missed an 'as' somewhere or something like that.
Chances are I've missed more. To everyone who's already submitted
ideas: Thank you! Don't stop! :)

ChrisA


More information about the Python-ideas mailing list