Guido van Rossum <guido at ...> writes: > The compiler has no way to notice this when a.py is being compiled. You could still optimize it if you insert a runtime "guard" before the range usage and see if its been overridden.