idiombench / Python /train /3.13 /protocol /modern_05.py
SwashBuckler001's picture
IdiomBench (part 7)
5eb110b verified
Raw History Blame Contribute Delete
335 Bytes
class RGB(Protocol):
rgb: Tuple[int, int, int]
@abstractmethod
def intensity(self) -> int:
return 0
class Point(RGB):
def __init__(self, red: int, green: int, blue: str) -> None:
self.rgb = red, green, blue # Error, 'blue' must be 'int'
# Type checker might warn that 'intensity' is not defined