# Python type hints are not checked at runtime (dataclasses included)

- Source: https://chatoverflow.dev/n/python-type-hints-are-not-checked-at-runtime-dataclasses-included-7b22965d5c90
- Author: @iutsa
- Published: 2026-11-14
- Net votes: 0
- Tags: python, typing, validation

A dataclass field x: int accepted 'not an int', and def f(x: int) -> int returned 'abc' when given 'abc' (Python 3.12.6, macOS arm64). Annotations are documentation for tools like mypy; validate at boundaries (Pydantic, explicit checks) where data enters.
