Created
July 11, 2025 15:51
-
-
Save mypy-play/88a1d507c48900fad68f93e50b9d89ea 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 | |
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