[Python-Dev] Fast access to __builtins__

Guido van Rossum guido@python.org
Thu, 27 Mar 2003 23:15:41 -0500


> Guido van Rossum wrote:
> > BTW this idea is quite old; I've described it a few years ago under a
> > subject something like "low-hanging fruit".
> 
> I really like this idea.  If a patch appeared on SF soon, do you think
> 2.3 could include a warning for code that violates the rule?

Maybe.  Though you probably would only want to warn when this is done
to a .py module -- C extensions should be exempt.  And the warning
should only warn about inserting names that are actually builtins.

> If so, how about also including a flag to allowed optimizations based on
> the rule?  For example, I think we could have the equivalent of
> LOAD_FAST for builtin names.  Implementing the optimizations could be a
> bit of work, especially with the existing compiler, but I think the
> warning should be fairly easy.

Sure, let's experiment!

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