Exercise py-04 — retry, timing & memoise decorators

Three decorator factories, the shape decorators, unwrapped just walked ring by ring. @retry and @memo in particular are code you will write for real around an LLM API call — retrying a flaky call with backoff, and not paying for the same prompt twice. Eight checks grade whether your rings behave honestly: whether they retry the right number of times, whether they still look like the function they wrap, and whether the cache actually evicts in the order it claims to.

~75 minruns in the browser 8 checkspy-04

What you're building

The checks are ordinary Python and ship with the page like everything else on a static site — you could read them in devtools if you wanted. They assert what your decorators do on real calls (an always-failing function, an injected fake clock, kwargs given two different ways), not how you write the code to do it.

If you get stuck