def f(x: float) -> int: return int(x) print(f.__annotations__['x']) print(f.__annotations__['return']) fname: str = "Kyle" print(f"fname variable of content 'Kyle' is of type: {__annotations__}") class Vector2: x: float # the ": float" annotates variable/name x to hint e.g. pylint that it ought to be a float y: float