Let's say that you're making a web request maybe to an API. But the request does take a bit of time. We can measure this in Jupyter via the %%time magic command. Instead of rerunning the same request and waiting for a response we could choose to cache the result. A convenient method for this is the lru_cache decorator that can be found in functools.

Calmcode