With mypy, reveal_type() can get the type of Tin a generic class as shown below:
class MyCls[T = int]:
# class MyCls(Generic[T]):
def __init__(self, x: T | None = None) -> None: ...
reveal_type(MyCls()) # builtins.int
reveal_type(MyCls[int]()) # builtins.int
reveal_type(MyCls[bool]()) # builtins.bool
reveal_type(MyCls[float]()) # builtins.float
reveal_type(MyCls[str]()) # builtins.str
reveal_type(MyCls(100)) # builtins.int
reveal_type(MyCls(True)) # builtins.bool
reveal_type(MyCls(3.14)) # builtins.float
reveal_type(MyCls('Hello')) # builtins.str
reveal_type(MyCls[int](100)) # builtins.int
reveal_type(MyCls[bool](True)) # builtins.bool
reveal_type(MyCls[float](3.14)) # builtins.float
reveal_type(MyCls[str]('Hello')) # builtins.str
But reveal_type()cannot get the type of Tin a generic function as shown below:
def func[T = int](x: T | None = None) -> None: ...
reveal_type(func()) # None
reveal_type(func(100)) # None
reveal_type(func(True)) # None
reveal_type(func(3.14)) # None
reveal_type(func('Hello')) # None
So are there any ways to get the type of Tin a generic function?