Duck Typing and Protocols

Talk it through with a coach who asks guiding questions and gives hints until you reach the answer. Pass to mark the challenge as completed.

The problem

  • hard
  • Pro

A function accepts anything with a read method, and your team wants type hints without forcing every caller to inherit from a base class. Explain duck typing, abstract base classes and typing protocols, and when you'd use each.

Talk this problem through with an AI coach

This is a Pro challenge. Sign in with Google, then upgrade to start a voice session.

Start free →