Skip to content

Glossary: Algorithms Beyond the Basics

@cache

Also written: functools.cache, cache, functools, functools module

A decorator from Python's `functools` module that gives a function its own memo dict. Calls with the same arguments, such as `ways_fast(100)`, are then answered by lookup instead of being recomputed.

Where the book teaches it

Related terms

DecoratorHashableMemoization