Journey to Master Python (WIP)

ageekymonk
35.3K views

Open Source Your Knowledge, Become a Contributor

Technology knowledge has to be shared and made accessible for free. Join the movement.

Create Content

Functools module

Memoization

Functools module supports memoization through lru_cache decorator. This way you dont need to write memoization code.

In the example adding the decorator @lru_cache does the needful. You can also see the cache details with cache_info

lru_cache Decorator
Open Source Your Knowledge: become a Contributor and help others learn. Create New Content