For the most part, CPython performs few optimisations by itself. You may be interested in psyco, which performs several heavy optimisations on running Python code.
http://psyco.sf.net/ Defining a function inside a loop in CPython will cause a new function object to be created each and every time the loop runs. No such automatic optimisation is performed there. For the most part, this lack of opimisation not only simplifies the CPython implementation, but also causes code to act much more closely to how it was defined, which is good for new and advanced users alike. Other than psyco, IronPython and PyPy are two projects which you might be interested in if execution performance is of interest to you. http://www.ironpython.com/ http://codespeak.net/pypy/ David. -- http://mail.python.org/mailman/listinfo/python-list