Created
November 10, 2025 22:22
-
-
Save mypy-play/d2db12a78c27d6dd5e95067459eea79c 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 __future__ import annotations | |
| from typing import TypeVar | |
| VALUES: dict[str, str] = {"SIZE": "100", "ADDR": "0x100", "NAME": "potato"} | |
| T = TypeVar("T", bound=str | int) | |
| def get_parameter(parameter: str, _rtype: type[T]) -> T: | |
| """Get the parameter""" | |
| if parameter == "SIZE": | |
| return 5 | |
| return "potato" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment