PyDocs

Nav

Development Tools

ReadOnly

typing

data · Added in 3.13
A special typing construct to mark an item of a TypedDict as read-only.

For example::

    class Movie(TypedDict):
        title: ReadOnly[str]
        year: int

    def mutate_movie(m: Movie) -> None:
        m["year"] = 1992  # allowed
        m["title"] = "The Matrix"  # type checker error

There is no runtime checking for this property.
0 Examples
No examples for typing/ReadOnly.
See Also
No see-alsos for typing/ReadOnly
0 Notes
No notes for ReadOnly