====== Python Typehints ======
> ab Python 3.10 [[https://peps.python.org/pep-0604/|PEP 604]] – Allow writing union types as X | Y
===== Standard Typen =====
int
str
...
===== Benutzerdefinierte Typen =====
Check
from typing import NewType
RGB = NewType("RGB", tuple[int, int, int])
Check
from typing import TypeVar
TypeVar ..... # < 3.12
===== Generische Typen =====
def funktion[T](items: list[T]) -> T: # ab 3.12
====== Notizen ======
> ab Python 3.5 ([[https://peps.python.org/pep-0484/|PEP 484 – Type Hints]])
Any, Union, Tuple, Callable TypeVar, Generic\\ Dict, List
= NewType('', int)