Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

gh-105074: Show an optional key in the TypedDict.__total__ example - #162889

Open
saggl wants to merge 1 commit into
python:mainfrom
saggl:gh-105074-typeddict-total-example
Open

saggl wants to merge 1 commit into
python:mainfrom
saggl:gh-105074-typeddict-total-example

Conversation

@saggl

@saggl saggl commented Nov 30, 2026 •

Copy link
Copy Markdown

TypedDict.__total__ records the value of the total argument on the class. The example now shows a total=True class whose label key can be omitted, and uses __optional_keys__ to identify that key.

The surrounding text now mentions that NotRequired overrides the default for an individual key. The two classes in the __total__ example also have distinct names.

All 82 doctests in Doc/library/typing.rst passed. I used Codex to help prepare the patch and run the tests.

Closes #105074.

@read-the-docs-community

Copy link
Copy Markdown

Documentation build overview

📚 cpython-previews | 🛠️ Build #36277338 | 📁 Comparing 9af2b4a against main (114f465)

  🔍 Preview build  

1 file changed
± library/typing.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting review docs Documentation in the Doc dir skip news

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

Difference in __total__ TypedDict using NotRequired

1 participant