[Python-3000] Change to class construction?
rrr at ronadam.com
Tue Jul 10 02:40:18 CEST 2007
Guido van Rossum wrote:
> We could easily change this to return a
> writable mapping that's not a dict at all but a "view" on the locals
> just as dict.keys() returns a view on a dict. I don't see why locals()
> couldn't return the object used to represent the namespace, but I
> don't see that it couldn't be some view on that object either,
> depending on the details of the implementation.
This sounds great! I just recently wanted to pass a namespace to exec, but
it refuses to accept anything but a dictionary for a local name space.
What I really want to do is pass an object as the local namespace. And
have the exec() use it complete with it's properties intact. Passing
obj.__dict__ doesn't work in this case.
More information about the Python-3000