Memoization is a programming technique (even an OO design pattern. The wikipedia article to which I've linked even shows a trivial Python implementation of a memoize function. A more complete recipe ...