Question
What deeper point about Context Managers should a senior Python developer mention?
- At senior level, the right answer is that Context Managers exists mostly for historical syntax reasons.
- Senior answers mention __enter__/__exit__, failure safety, and why resource lifetime should be visible in the code shape.
- At senior level, Python removes the tradeoffs around Context Managers, so design choices barely matter in practice.
- At senior level, any approach to Context Managers is equally correct if it passes one small local test.
Hint
Look beyond syntax and explain the runtime, API, or design consequence.
Answer and rationale
Correct answer: B. Senior answers mention __enter__/__exit__, failure safety, and why resource lifetime should be visible in the code shape.
Senior answers mention __enter__/__exit__, failure safety, and why resource lifetime should be visible in the code shape. This is the kind of tradeoff-aware answer senior interviews usually expect.
Track: Python