a read

This simple decorator can significantly speed up recursive functions in python by storing solutions in a dictionary as it runs. The code uses the new typing library introduced in python 3.5 but it isn’t strictly necessary. It supports functions with any number of input parameters.

note: that the solution dictionary is tied to the function itself so multiple calls to the same function will reuse cached solutions from any previous calls.