[Python-ideas] except expression

Nick Coghlan ncoghlan at gmail.com
Sat Feb 15 01:46:27 CET 2014


On 15 February 2014 07:29, Jan Kaliszewski <zuo at chopin.edu.pl> wrote:
> 13.02.2014 13:50, Nick Coghlan wrote:
>
>> Some of the specific syntactic proposals:
>>
>>     x = op() except default if Exception
>>     x = op() except default for Exception
>>     x = op() except default from Exception
>>     x = op() except Exception return default
>>
>>     x = op() except exc.attr if Exception as exc
>>     x = op() except exc.attr for Exception as exc
>>     x = op() except exc.attr from Exception as exc
>>     x = op() except Exception as exc return exc.attr
>
>
> Please append also my proposal from another branch of this thread

There's currently no volunteer to write a PEP - my post was just an
illustration of the kinds of things such a PEP would need to consider.
Until there is such a volunteer, the many syntax variants will remain
scattered throughout the thread, and we'll likely end up rehashing the
discussion in a couple of years time.

Note that writing a PEP isn't that complicated - the general process
is covered in PEP 1, and the PEP editors take care of most of the
details of checking that the markup is correct and then actually
posting it on python.org (by committing it to the PEPs repo).

So, if anyone would like to write up this discussion, it will involve
a few things:

1. Having enough time to follow the discussion and update it with new
variants and any new open questions that come up
2. Being willing to read old PEPs for similar ideas (notably PEP 308
which added conditional expressions, but also those for yield from,
the with statement, etc), and use those as a guide to the kind of
things that need to be accounted for in a new syntax proposal
3. Being able to write up the proposal in such a way that it presents
a clear rationale (based on the thread - in particular noting the
uneven impact the lack of such a feature is having on function API
designs), a clear *semantic* proposal (what does the new construct
actually do, what is the scope of any name bindings involved, what
scope do subexpressions evaluate in, etc), and then a presentation of
the (many) syntactic proposals.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia


More information about the Python-ideas mailing list