Typing and Generics
typing.NoReturn
Indicates a function cannot return normally, for example because it always raises. Equivalent to Never in static typing; neither annotation enforces termination at runtime.
Formal Syntax & Structure
python syntaxpython
typing.NoReturnReturn Value
NoReturn
Typing construct or runtime result as described; static typing rules are not runtime validation.
Working Example
Example Snippetpython
from typing import NoReturn
def stop() -> NoReturn: raise RuntimeError('stop')print(stop.__annotations__['return'] is NoReturn)