Python Programming - Decorators - Discussion

Discussion Forum : Decorators - General Questions (Q.No. 11)
11.
What is the primary purpose of the @contextmanager decorator?
Converts a method to a class method
Creates a context manager for resource management
Marks a method as a static method
Decorates a method with dynamic behavior
Answer: Option
Explanation:
The @contextmanager decorator is used to create a context manager, allowing resource allocation and deallocation to be managed using the with statement.
Discussion:
Be the first person to comment on this question !

Post your comments here:

Your comments will be displayed after verification.