The functools module is the standard library’s toolbox for working with functions. You have already met pieces of it: partial, reduce and wraps. This lesson completes the picture, with the tool that makes the biggest practical difference: a cache that remembers a function’s results, so that the same question is never answered twice. It only works safely for pure functions, which is where the last lesson led.
More lessons in Complete Python Programming