Python Programming - Decorators - Discussion

Discussion Forum : Decorators - General Questions (Q.No. 34)
34.
What is the primary use case for the @contextlib.ExitStack?
Converts a method to a class method
Manages a stack of cleanup callbacks for managing resources
Marks a method as a static method
Decorates a method with dynamic behavior
Answer: Option
Explanation:
The @contextlib.ExitStack is used for managing a stack of cleanup callbacks, making it useful for managing resources within a context.
Discussion:
Be the first person to comment on this question !

Post your comments here:

Your comments will be displayed after verification.