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

A generator-based context manager uses @contextmanager. What happens if the wrapped generator does NOT yield (zero yields) when the `with` block is entered?

from contextlib import contextmanager @contextmanager def cm(): if False: yield with cm() as x: print("in block")