Typing and Generics
typing.ReadOnly
Marks a TypedDict item as read-only for static checking. Added in 3.13; it neither makes the dictionary immutable at runtime nor recursively freezes nested values.
Formal Syntax & Structure
python syntaxpython
typing.ReadOnly[T]Return Value
type qualifier
Typing construct or runtime result as described; static typing rules are not runtime validation.
Working Example
Example Snippetpython
from typing import ReadOnly, TypedDict
class Job(TypedDict): id: ReadOnly[int] note: strprint((sorted(Job.__readonly_keys__), sorted(Job.__mutable_keys__)))