from typing import Optional, List, Protocol class Combiner(Protocol): def __call__(self, *vals: bytes, maxlen: Optional[int] = None) -> List[bytes]: ... def good_cb(*vals: bytes, maxlen: Optional[int] = None) -> List[bytes]: ... def bad_cb(*vals: bytes, maxitems: Optional[int]) -> List[bytes]: ... comb: Combiner = good_cb # OK comb = bad_cb # Error! Argument 2 has incompatible type because of # different name and kind in the callback