[Python-Dev] Static scoping of builtins (Re: Dynamic nested scopes)

Guido van Rossum guido@python.org
Sun, 05 Nov 2000 21:05:20 -0500


> Guido:
> > I'd be happy to make an explicit list of
> > those builtins that should not be messed with

[Greg Ewing]
> There's a precedent for this in Scheme, which has a notion
> of "integrable procedures".

Good!

> As for the rest, with static scoping it will be possible to
> make access to builtins just as efficient as locals, while
> still allowing them to be rebound, so there's no reason why
> __builtin__.__dict__.open = foo can't continue to work,
> if so desired.

I'm not sure what you mean.  With integrable procedures (whatever they
may be :-) I believe this is possible.  Without them, the lookup in
globals() can be skipped for builtins, but a local is accessed with
*zero* dict lookups -- how would you do this while still supporting
__builtin__.__dict__.open = foo?  have "hookable" dictionaries?
(Those would solve a bunch of problems, but are not under
consideration at the moment.)

--Guido van Rossum (home page: http://www.python.org/~guido/)