[Python-Dev] Fast access to __builtins__

Skip Montanaro skip@pobox.com
Thu, 27 Mar 2003 16:17:53 -0600


    Raymond> From past rumblings, I gather that Python is moving towards
    Raymond> preventing __builtins__ from being shadowed.

    Raymond> I would like to know what you guys think about going ahead with
    Raymond> that idea whenever the -O optimization flag is set.

Interesting idea, but I think of shadowing builtins being somewhat
orthogonal to optimization in the usual sense (speed things up without
changing the program's semantics).  This is clearly a semantic change, so
I'd like to see a different command line flag control this behavior.

What happens if you run one program with builtin shadowing enabled, it
writes some .pyo files with your suggested change, then later you run
another program without it?  Seems like there should be some memory in the
file of how it was generated so the importer can raise an exception if it
finds a mismatch between the shadowing command line flag and a previously
generated bytecode file.

Skip