[Python-ideas] except expression

Chris Angelico rosuav at gmail.com
Tue Feb 18 01:06:22 CET 2014


On Tue, Feb 18, 2014 at 10:54 AM, Nick Coghlan <ncoghlan at gmail.com> wrote:
>> I haven't studied the compiler closely enough to
>> tell how difficult this would be to achieve, though.
>> Whoever implemented inner scopes for list comprehensions
>> reportedly found it harder than he liked at the time.
>
> That was me, and it's handling nested closures correctly that gets
> excruciatingly difficult. In theory, the compiler has enough info to figure
> out the details and generate appropriate inline code, but in practice,
> reusing the existing closure support made the change so much simpler to
> implement that was the option I eventually chose.

Thanks Nick. Useful explanation, and now linked to in the PEP draft.

https://github.com/Rosuav/ExceptExpr/raw/master/pep.txt

ChrisA


More information about the Python-ideas mailing list