Created
July 11, 2025 05:17
-
-
Save mypy-play/d2988dd6acfa1dd499b2a64918a7a26f to your computer and use it in GitHub Desktop.
Shared via mypy Playground
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import typing as tp | |
class Wrapped[**P, T]: | |
def __call__(self, *args: P.args, **kwargs: P.kwargs) -> T: | |
raise NotImplementedError | |
def inner[**P, T](f: tp.Callable[P, T]) -> Wrapped[P, T]: | |
assert False | |
class K: | |
@inner | |
def f(self, x: int): | |
return x | |
def g(self, x: int): | |
return x | |
a = K() | |
a.g(2) | |
a.f(2) # fails with x missing |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment