Here is an interesting example of a decorator that munges the bytecodes of a function to optimize it: http://code.activestate.com/recipes/277940/ Kent