GeezerVison is showing github.com — frozendict is not mentioned in Doc/reference/expressions.rst · Issue #161608 · python/cpython
frozendict is not mentioned in Doc/reference/expressions.rst #161608DescriptionDocumentation
frozendict was added as a built-in type in 3.15 (PEP 814) and is documented in
the data model ("Frozen dictionaries" in Doc/reference/datamodel.rst), but
Doc/reference/expressions.rst still lists only dict wherever it enumerates
built-in mapping types. Three places seem to need an update:
-
"Value comparisons", the bullet about mappings:
Mappings (instances of :class:dict) compare equal if and only if they have
equal (key, value) pairs. [...]
frozendict is not a subclass of dict, so it is not covered by "instances of
dict", yet it follows the same rules, and the two types compare equal to each
other:
dict(a=1, b=2) == frozendict(a=1, b=2)
True
Suggested: "Mappings (instances of :class:dict or :class:frozendict)
compare equal if and only if they have equal (key, value) pairs."
The following sentence about order comparisons raising TypeError applies to
frozendict as well.
-
"Membership test operations":
For container types such as list, tuple, set, frozenset, dict, or
collections.deque, the expression x in y is equivalent to
any(x is e or x == e for e in y).
Suggested: add frozendict to the list.
-
"Boolean operations", the list of values interpreted as false:
[...] and empty strings and containers (including strings, tuples, lists,
dictionaries, sets and frozensets).
Suggested: add "frozendicts" (an empty frozendict is false like any other
empty container).
Minor, optional: the section "Binary arithmetic operations" says that some of
these operations apply to non-numeric types, but only describes numbers and
sequences. The - operator on sets (difference) and | on dicts are not
mentioned there (they are documented with the types themselves).
Linked PRs
Activitynilayp-codes commented on Nov 8, 2026 I'd like to work on this. I checked current main: the three spots are lines 2177, 2258 and 2329 of Doc/reference/expressions.rst, and :class:frozendict resolves to the entry in Doc/builtins/stdtypes.rst. I'll keep the PR to those three edits and leave the optional arithmetic-operators note for a separate issue. Reacted by Bartosz Sławecki and sobolevn
MetadataMetadataStatusShow more project fields
DevelopmentNo branches or pull requestsIssue actions
|