Ctrl K
Python · Junior · Theory

Why does Python need type annotations if it's a dynamic language? Are they checked when the program runs?

~4 min by voice

How to approach it

They're checking whether you understand that type annotations in Python are metadata for people and tools, not a runtime check. They also look at whether you know who actually uses them and how: mypy/pyright, the IDE, Pydantic/FastAPI.

Have you seen this question in a real interview?
Answers0
Avg. score—
Strong—
Practiced0
Topics
Similar questionsYour project just added mypy, and you need to type a function that accepts any object with a read method. Would you describe that type with a Protocol or with an abstract base class, and how do they differ? Mid-levelWhen do you choose typing.Protocol and when an abstract base class? And how do you generally organize typing and mypy in a large project? Senior

Answer by voice

The interviewer will ask this question and listen. Think out loud and ask for a hint if you need one. When you're done, pause or tap “That's my answer”. In about a minute, your score and the points you covered show up here.

Sign in to answer

Best with headphones · ~4 min