Skip to content

Instantly share code, notes, and snippets.

@mypy-play
Created November 10, 2025 22:27
Show Gist options
  • Save mypy-play/b0801cc0b4b4e1791b79e721d3180bc7 to your computer and use it in GitHub Desktop.
Save mypy-play/b0801cc0b4b4e1791b79e721d3180bc7 to your computer and use it in GitHub Desktop.
Shared via mypy Playground
from __future__ import annotations
from typing import TypeVar
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