Python Programming - Decorators - Discussion

Discussion Forum : Decorators - General Questions (Q.No. 2)
2.
Which of the following decorators is used to cache the result of a function to improve performance?
@staticmethod
@property
@functools.lru_cache
@classmethod
Answer: Option
Explanation:
The @functools.lru_cache decorator is used to cache the result of a function with the least recently used (LRU) strategy, improving the performance by avoiding redundant calculations.
Discussion:
Be the first person to comment on this question !

Post your comments here:

Your comments will be displayed after verification.