Skip to content

Instantly share code, notes, and snippets.

@mypy-play
Created July 11, 2025 15:51
Show Gist options
  • Save mypy-play/88a1d507c48900fad68f93e50b9d89ea to your computer and use it in GitHub Desktop.
Save mypy-play/88a1d507c48900fad68f93e50b9d89ea to your computer and use it in GitHub Desktop.
Shared via mypy Playground
import typing
def apply_on_answer[T](f: typing.Callable[[int], T], /) -> T:
return f(42)
class C:
@apply_on_answer
def x(answer: int) -> int:
return answer
reveal_type(x)
reveal_type(C.x)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment