In a previous blog post, I've estimated Python OO method call overhead to be about 10% over function calls. What about exception handling?
If the profiling shows that you call some function a lot of times for the same arguments, then memoise it. The canonical example is memoising the intermediate results of the Fibonacci recursive calculator, presented below. But beware: if you do memoise, better make sure that you don't eat up the full memory! Memoising is a classic speed versus memory dilemma.
Python function calls are expensive. Python object oriented method calls are even more expensive. How can we estimate method call overhead?
A simple (and sometimes very efficient) way to speed up your Python programs is via the Psyco module. But beware, Psyco only runs on 32-bit OSes.
A danger of machinable software engineering factory: average style of programming.