On Nov 26, 2007 3:21 PM, Greg Ewing
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 notwithstanding). -- --Guido van Rossum (home page: http://www.python.org/~guido/)