FastAPI
Lifespan
An async context manager for application startup and shutdown, replacing the deprecated on_event handlers.
Why interviewers ask about it
Setup before yield, teardown after. It keeps paired resources together and attaches shared state to the app rather than to globals.
Related terms
This term is part of the free Python Full-Stack interview preparation module - browse the full glossary for every definition.