Download Python/train/3.13/protocol/modern_03.py from SwashBuckler001/idiombench: direct link, hf CLI and curl.
- Browser
- Download file 465 Bytes
-
https://huggingface.co/datasets/SwashBuckler001/idiombench/resolve/main/Python/train/3.13/protocol/modern_03.py
- Command line
-
hf download hf://datasets/SwashBuckler001/idiombench/Python/train/3.13/protocol/modern_03.py
-
curl -L -o modern_03.py https://huggingface.co/datasets/SwashBuckler001/idiombench/resolve/main/Python/train/3.13/protocol/modern_03.py
465 Bytes
| from typing import Protocol, List | |
| class Template(Protocol): | |
| name: str # This is a protocol member | |
| value: int = 0 # This one too (with default) | |
| def method(self) -> None: | |
| self.temp: List[int] = [] # Error in type checker | |
| class Concrete: | |
| def __init__(self, name: str, value: int) -> None: | |
| self.name = name | |
| self.value = value | |
| def method(self) -> None: | |
| return | |
| var: Template = Concrete('value', 42) # OK | |