Python Programming - Functions - Discussion

Discussion Forum : Functions - General Questions (Q.No. 70)
70.
What is the purpose of the functools.lru_cache decorator?
To create a local variable with cache.
To create a global variable with cache.
To cache the results of a function, saving time for repeated calls with the same arguments.
To limit the number of recursive calls in a function.
Answer: Option
Explanation:
The functools.lru_cache decorator in Python is used to cache the results of a function, reducing the computation time for repeated calls with the same arguments.
Discussion:
Be the first person to comment on this question !

Post your comments here:

Your comments will be displayed after verification.