Screw the protocol!
What this preview is
Screw the protocol! is a medium quant interview question on language knowledge in Python.
- Difficulty
- Medium
- Topic
- Language Knowledge
- Discipline
- Quant development
- Language
- Python
- Companies
- 0
Understanding Python type-checking edge cases
This is a medium-difficulty Python question that tests your grasp of type annotations and how static type checkers (like mypy) enforce them. Rather than executing code, you must reason about what a typechecker will accept—a skill essential for writing type-safe Python in production environments.
The question asks you to identify the correct type annotation or expression that satisfies the typechecker's constraints. This requires understanding the interaction between variable types, function signatures, and how type checkers validate assignments and function calls. You may need to consider union types, optional types, or protocol violations—or recognize when no valid annotation exists.
- Type inference and explicit annotations
- Protocol compliance and structural typing
- Union and optional types
- Type-checker error reporting
Related practice
Unlock full access to getcracked
Join to unlock this question, detailed solutions, and our complete library of quant finance interview prep.