Type annotations are optional in Python, but they can be used by type checkers or linters, and are useful for making the code purpose clearer

Types

Basic

int
float
bool
str

Collections

list[int/x/./...
set[x]
dict[x,y]

Annotating

Variables

variable: type = value
name: string = "Bob"

Functions

def some_function(param: int = default_value) -> str:
	...

mypy typing cheatsheet