[Python-ideas] __builtins__ behavior and... the FUTURE!

Guido van Rossum guido at python.org
Tue Nov 27 00:29:10 CET 2007

On Nov 26, 2007 3:21 PM, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
> Guido van Rossum wrote:
> > The semantics of __builtins__ are an implementation detail used for
> > sandboxing, and assignment to __builtins__ is not supported.
> Perhaps in 3.0 there could be an additional argument to
> eval and exec for supplying a builtin namespace? Then
> sandboxing code wouldn't have to make assumptions about
> the implementation, and the way would be open for
> optimising it in any way we wanted.

Good idea. If only I hadn't made a mistake in the signature design...
It's kind of awkward to have it be exec(code, globals, locals,
builtins), but I'm afraid that changing it to exec(code, locals,
globals, builtins) would break too much code in the transition (2to3

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

More information about the Python-ideas mailing list