# Protocol

say it: **“PROH-tuh-kawl”** **/ˈproʊtəkɔːl/**

Describes what an object must be able to do, whatever class it is.

## What is a `Protocol` in Python typing?

A `Protocol` describes what an object must be able to do, like "has a `pay()` method", without caring which class it comes from.

```python
from typing import Protocol

class PaymentMethod(Protocol):
    def pay(self, amount: float) -> None: ...

def checkout(method: PaymentMethod, total: float) -> None:
    method.pay(total)   # any object with pay() works
```

Level: Freelancer · [More Python terms at this level](https://www.ask-codey.com/glossary?category=python&level=4)

Updated: November 17, 2026

## In other subjects

- [Protocol in Web Development](https://www.ask-codey.com/glossary/protocol-web-development)

Source: https://www.ask-codey.com/glossary/protocol
