Examveda

How does the @contextmanager decorator facilitate context management?

A. By creating context managers automatically

B. By adding new context to existing managers

C. By wrapping functions with context management behavior

D. By removing context from code

Answer: Option C

Solution (By Examveda Team)

The @contextmanager decorator allows a function to act as a context manager with the with statement.

This Question Belongs to Python Program >> Decorators In Depth

Join The Discussion

Related Questions on Decorators in Depth