[Python-Dev] Re: Dynamic nested scopes

Guido van Rossum guido@python.org
Fri, 03 Nov 2000 08:05:08 -0500

> On Thu, 2 Nov 2000, Guido van Rossum wrote:
> > I think Python 3000 ought to use totally static scoping.  That will
> > make it possible to do optimize code using built-in names!

> Isn't that another way of saying you want the builtin names to be
> part of the language definition? Part of today's method advantages
> is that new builtins can be added without any problems.

The built-in names have always been part of the language definition in
my mind.  The way they are implemented doesn't reflect this, but
that's just an implementation detail.  How would you like it if
something claimed to be Python but didn't support len()?  Or map()?

That doesn't mean you can't add new built-ins, and I don't think that
the new implementation will prevent that -- but it *will* assume that
you don't mess with the definitions of the existing built-ins.

Of course you still will be able to define functions whose name
overrides a built-in -- in that case the compiler can see that you're
doing that (because it knows the scope rules and can see what you are
doing).  But you won't be able to confuse someone else's module by
secretly sticking a replacement built-in into their module's __dict__.

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