Right that makes sense. Is there any precedent for non-keywords being special cased by the compiler (I'm thinking specifically of Exceptions)? There's obviously from __future__ imports, but I think going in that direction would be simultaneously elegant, explicit, backwards compatible, and an awful idea.


On Mon, May 2, 2016 at 7:32 PM Greg Ewing <greg.ewing@canterbury.ac.nz> wrote:
Joshua Morton wrote:
> would something like replacing all attribute access with a
>     try:
>         x
>     except NameError:
>         namespace.x  # or something like this
> work, or are you saying that since 'namespace' wouldn't be in slots
> either, this would fail?

I meant that Namespace can't be an ordinary Python object
that works without cooperation from the compiler. If the
compiler is allowed to recognise the use of Namespace
and generate different code, anything is possible.

Python-ideas mailing list
Code of Conduct: http://python.org/psf/codeofconduct/