Created
January 25, 2026 14:49
-
-
Save mypy-play/394d680facba8b792f1300b03a3c1b58 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
| from typing import reveal_type | |
| import random | |
| def choice[T](left: T, right: T) -> T: | |
| if random.random() < 0.5: | |
| return left | |
| else: | |
| return right | |
| reveal_type(choice(3, "hey!")) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment