Python language

Context manager

An object implementing __enter__ and __exit__, used with the with statement.

Why interviewers ask about it

It is try/finally with a name. __exit__ runs even on exception, and returning True from it suppresses the exception - a detail worth knowing but rarely worth using.

This term is part of the free Python Full-Stack interview preparation module - browse the full glossary for every definition.