[Python-Dev] Tangent on class level scoping rules (was Re: PEP 463: Exception-catching expressions)

Nick Coghlan ncoghlan at gmail.com
Sat Feb 22 15:42:06 CET 2014


On 22 Feb 2014 09:59, "Greg Ewing" <greg.ewing at canterbury.ac.nz> wrote:
>
> Nick Coghlan wrote:
>>
>> As Chris later noted, you likely *could* still implement expression
>> local name binding for an except expression without a full closure, it
>> would just be rather difficult.
>
>
> I'm still not convinced it would be all *that* difficult.
> Seems to me it would be semantically equivalent to
> renaming the inner variable and adding a finally clause
> to unbind it. Is there something I'm missing?

Dealing with references from nested closures is the hard part. It's not
impossible to solve, but would require introducing a new kind of scope not
previously seen in Python, which is a  rather dubious suggestion when the
existing closure semantics can typically do the job. However, we're getting
off topic for python-dev.

Cheers,
Nick.

>
> --
> Greg
>
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> https://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe:
https://mail.python.org/mailman/options/python-dev/ncoghlan%40gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20140223/c136454a/attachment.html>


More information about the Python-Dev mailing list