How to inspect return type of Callable
How to inspect return type of Callable Question: Let’s say I have something like the following: import inspect from collections.abc import Callable # Using Python 3.10+ from typing import get_type_hints def foo(arg: Callable[…, int]) -> None: pass type_hints = get_type_hints(foo)["arg"] annotation = inspect.signature(foo).parameters["arg"].annotation # How can one get the return type `int` from either of …