Python language

Protocol (structural typing)

typing.Protocol - a class matches by having the right methods, without inheriting anything.

Why interviewers ask about it

Static duck typing. The contrast with ABC is the answer: ABC requires explicit inheritance and enforces at instantiation; Protocol is checked by the type checker and requires nothing at runtime.

This term is part of the free Python Full-Stack interview preparation module - browse the full glossary for every definition.