Automatic, portable optimization of global access
Fri Apr 16 07:06:04 CEST 2004
python at rcn.com (Raymond Hettinger) writes:
> """ Binding should be applied selectively to those functions where
> speed is important and dynamic updates are not desired (i.e. the
> globals do not change). In more dynamic environments, a more
> conservative approach is to set builtin_only to True so that only the
> builtins get optimized (this includes functions like len(), exceptions
> like IndexError, and constants like True or False).
Well, it's possible that builtins get changed too. I've used "len" as
a variable a few times without realizing that I was clobbering a builtin.
Maybe the compiler could detect when it's ok to run the optimizer, and
automatically run it when it can.
More information about the Python-list