Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumPythoncontextmanagerSingle-choice MCQ

In a @contextmanager generator, the exception thrown at `yield` is caught and the generator then returns normally (does not re-raise). What does the with-statement do?

from contextlib import contextmanager @contextmanager def cm(): try: yield except ValueError: pass with cm(): raise ValueError('boom') print('reached')