Skip to content

gh-157747: Document that ** unpacking accepts any object with keys() - #157771

Open
lazerg wants to merge 1 commit into
python:mainfrom
lazerg:fix-issue-157747
Open

lazerg wants to merge 1 commit into
python:mainfrom
lazerg:fix-issue-157747

Conversation

@lazerg

@lazerg lazerg commented Sep 18, 2026

Copy link
Copy Markdown

The reference says ** unpacking, both in dict displays and in calls, needs a mapping, and the glossary defines that as something implementing the full collections.abc.Mapping ABC. At runtime CPython only calls keys() and then __getitem__(), so objects like a pandas DataFrame work fine even though they are not mappings. This rewords both places to match what the interpreter does, using the same wording as the dict constructor and dict.update() docs.

Fixes #157747

@read-the-docs-community

read-the-docs-community Bot commented Sep 18, 2026

Copy link
Copy Markdown

Documentation build overview

📚 cpython-previews | 🛠️ Build #34643352 | 📁 Comparing 3133b27 against main (0e1ae61)

  🔍 Preview build  

1 file changed
± reference/expressions.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.

[docs] dictionary unpacking fn(**kwargs) should accept SupportsKeysAndGetitem and not just Mapping

1 participant