Python Programming - Decorators - Discussion

Discussion Forum : Decorators - General Questions (Q.No. 21)
21.
What is the purpose of the @functools.retry decorator?
Retries a function with a specified delay in case of failure
Converts a method to a class method
Decorates a method with dynamic behavior
Provides a way to document and maintain the original function's metadata
Answer: Option
Explanation:
The @functools.retry decorator is used to retry a function with a specified delay in case of failure.
@functools.retry(max_retries=3, delay=2)
def unstable_function():
    # Function implementation
Discussion:
Be the first person to comment on this question !

Post your comments here:

Your comments will be displayed after verification.