def f(a: int, b: str, c: float): import inspect args = inspect.getfullargspec(f).args annotations = inspect.getfullargspec(f).annotations for x in args: print( x, "->", "arg is", type(locals()[x]), ",", "annotation is", annotations[x], "/", (type(locals()[x])) is annotations[x], ) f(1, "foo", 3.3) print("\n\n") f("foo", 4.3, 9) print("\n\n") f(1, "foo", "bar")