summaryrefslogtreecommitdiffstats
path: root/annotations.py
blob: fe48791bb554e67b3d7cdd459d212aff53a8087a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
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