Python Programming - Decorators - Discussion

Discussion Forum : Decorators - General Questions (Q.No. 4)
4.
Which built-in decorator is used to enforce that a function is only called once?
@staticmethod
@functools.lru_cache
@functools.singledispatch
@functools.singledispatchmethod
Answer: Option
Explanation:
The @functools.singledispatch decorator is used to define a single-dispatch generic function, ensuring that the function is only called once for a particular type.
Discussion:
Be the first person to comment on this question !

Post your comments here:

Your comments will be displayed after verification.