Skip to content

gh-141510: Change repr(frozendict) for empty dict - #144921

Merged
vstinner merged 2 commits into
python:mainfrom
vstinner:frozendict_repr_empty
Feb 17, 2026
Merged

vstinner merged 2 commits into
python:mainfrom
vstinner:frozendict_repr_empty

Conversation

@vstinner

@vstinner vstinner commented Feb 17, 2026 •

Copy link
Copy Markdown
Member

repr(frozendict()) returns "frozendict()" instead of "frozendict({})".

repr(frozendict()) returns "frozendict()" instead of
"frozendict({})".
@vstinner

Copy link
Copy Markdown
Member Author

For example, frozenset has a similar formatting:

>>> frozenset()  # empty
frozenset()
>>> frozenset("a")
frozenset({'a'})

@corona10 corona10 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@vstinner
vstinner enabled auto-merge (squash) February 17, 2026 17:52
@vstinner
vstinner merged commit d1505b5 into python:main Feb 17, 2026
41 checks passed
@vstinner
vstinner deleted the frozendict_repr_empty branch February 17, 2026 18:04
brijkapadia pushed a commit to brijkapadia/cpython that referenced this pull request Feb 28, 2026
repr(frozendict()) returns "frozendict()" instead of
"frozendict({})".
ljfp pushed a commit to ljfp/cpython that referenced this pull request Apr 25, 2026
repr(frozendict()) returns "frozendict()" instead of
"frozendict({})".
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

2 participants