example-code-2e/13-protocol-abc/typing/randompickload.py

7 lines
218 B
Python
Raw Normal View History

2021-05-21 23:56:12 +02:00
from typing import Protocol, runtime_checkable
from randompick import RandomPicker
@runtime_checkable # <1>
class LoadableRandomPicker(RandomPicker, Protocol): # <2>
def load(self, Iterable) -> None: ... # <3>