[Python-Dev] class name spaces inside an outer function
Nick Coghlan
ncoghlan at gmail.com
Sun Apr 28 03:26:28 CEST 2013
On 28 Apr 2013 04:30, "Ethan Furman" <ethan at stoneleaf.us> wrote:
>
> I filed bug http://bugs.python.org/issue17853 last night.
>
> If somebody could point me in the right direction (mainly which files to
look in), I'd be happy to attempt a patch.
Hmm, interesting challenge. A key part of the problem is that the 3.x
compiler assumes there's no way to inject names it doesn't know about into
code inside a function - we missed the fact that you could still do it with
a nested class and a metaclass __prepare__ method.
I suspect resolving it sensibly will require a new opcode that tries a
local-only load and then falls back to loading from a cell rather than from
a global/builtins lookup.
Cheers,
Nick.
>
> --
> ~Ethan~
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> http://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe:
http://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/20130428/82145e39/attachment.html>
More information about the Python-Dev
mailing list