2011/1/3 Alex Gaynor email@example.com
No, it's singularly impossible to prove that any global load will be any given value at compile time. Any optimization based on this premise is wrong.
That's your opinion, but I have very different ideas.
Of course we can't leave the problem only on the compiler shoulders, but I think that can be ways to threat builtins as "static" variables, and globals like local (fast) variables too, taking into account changes on the builtins' and modules dictionaries.
But it doesn't make sense to invest time in these things: JITs are becoming a good alternative, and may be they will be ready soon to take the CPython place as the "mainstream" implementation.