Skip to content

Instantly share code, notes, and snippets.

@mypy-play
Created July 11, 2025 05:17
Show Gist options
  • Save mypy-play/d2988dd6acfa1dd499b2a64918a7a26f to your computer and use it in GitHub Desktop.
Save mypy-play/d2988dd6acfa1dd499b2a64918a7a26f to your computer and use it in GitHub Desktop.
Shared via mypy Playground
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