Download Python/train/3.13/param-spec/modern_06.py from SwashBuckler001/idiombench: direct link, hf CLI and curl.
- Browser
- Download file 556 Bytes
-
https://huggingface.co/datasets/SwashBuckler001/idiombench/resolve/main/Python/train/3.13/param-spec/modern_06.py
- Command line
-
hf download hf://datasets/SwashBuckler001/idiombench/Python/train/3.13/param-spec/modern_06.py
-
curl -L -o modern_06.py https://huggingface.co/datasets/SwashBuckler001/idiombench/resolve/main/Python/train/3.13/param-spec/modern_06.py
556 Bytes
| P = ParamSpec("P") | |
| def foo(x: Callable[P, int], y: Callable[P, int]) -> Callable[P, bool]: ... | |
| def x_y(x: int, y: str) -> int: ... | |
| def y_x(y: int, x: str) -> int: ... | |
| foo(x_y, x_y) # Should return (x: int, y: str) -> bool | |
| foo(x_y, y_x) # Could return (__a: int, __b: str) -> bool | |
| # This works because both callables have types that are | |
| # behavioral subtypes of Callable[[int, str], int] | |
| def keyword_only_x(*, x: int) -> int: ... | |
| def keyword_only_y(*, y: int) -> int: ... | |
| foo(keyword_only_x, keyword_only_y) # Rejected | |