Question
Which statement about Type Hints and mypy is the strongest interview answer?
- Type Hints and mypy is mostly a naming style choice and has little effect on runtime behavior or design tradeoffs.
- Type Hints and mypy exists mainly to reduce the number of files in a Python project.
- Type hints document function contracts and let tools like mypy catch mismatches before runtime.
- Type Hints and mypy matters only for frontend scripting and not for backend or automation code.
Hint
Start with the core rule behind Type Hints and mypy.
Answer and rationale
Correct answer: C. Type hints document function contracts and let tools like mypy catch mismatches before runtime.
Type hints document function contracts and let tools like mypy catch mismatches before runtime. This is the base concept interviewers commonly test first.
Track: Python