[Python-Dev] Fast access to builtins (original) (raw)

Neil Schemenauer nas@python.ca
Thu, 27 Mar 2003 18:26:49 -0800


M.-A. Lemburg wrote:

Using the -O for this is not a working possibility. -OO is reserved for optimizations which can change semantics, but even there, I'd rather like a per-module switch than a command line switch.

Optimization options that globally change semantics seem like a bad idea. How would you know some module you are using will not break? I agree with Mark that a per-module switch would be better.

In this case, I'm not sure either option is necessary. If I understand Guido correctly, eventually programs may not be allowed to stick names into other modules that override builtins used by that module. If that is disallowed then the compiler knows if a name is a builtin or a global.

We could introduce a warning for code that breaks the new rules and have a future statement that implements the optimization.

Neil