I just started Python and I\'ve got no idea what memoization is and how to use it. Also, may I have a simplified example?
Memoization is keeping the results of expensive calculations and returning the cached result rather than continuously recalculating it.
Here's an example:
def doSomeExpensiveCalculation(self, input):
if input not in self.cache:
self.cache[input] = result
return self.cache[input]
A more complete description can be found in the wikipedia entry on memoization.