Skip to content
UPEEC

Type Hints

Optional annotations describing expected types — checked by tools like mypy and Pyright, ignored at runtime.

Easy
Comments 0
def ohms(v: float, i: float) -> float:
    return v / i

readings: list[float] = []
config: dict[str, int | None] = {}

Hints improve editor autocomplete and catch bugs before running. Libraries like Pydantic also use them for runtime validation.

Spotted a mistake or want to add detail? Suggest an improvement — Content Contributors' edits are reviewed by editors before they go live.

Discussion (0)

Sign in or join free to ask questions and discuss this topic.