News for hackers. Stuff that matters.
Re:Python Patterns - An Optimization Anecdote by riffraff on Tuesday November 02, 2010 @05:24AM (#1859717)
you can lookup once and inline the method, and only keep a flag to check if you need to invalidate that. Pypy & other jits al do this kind of things all the time :)

But you don't need a jit: you can partially execute the code and determine that no changes were happening in the referenced globals, thus the inlining becomes possible.

There is quite a bit of literature on the issue of using partial evaluation for optimizing dynamic/reflective languages.

Re:Python Patterns - An Optimization Anecdote by edanm on Tuesday November 02, 2010 @09:37AM (#1860334)
Interesting. What are the best sources for learning what kind of optimizations are actually implemented in practice in Python?
Re:Python Patterns - An Optimization Anecdote by riffraff on Tuesday November 02, 2010 @12:24PM (#1861083)
well neither of the above, in standard python, but the pypy project has _a lot_ of interesting stuff http://codespeak.net/pypy/dist/pypy/doc/extradoc.html