Hashable mappings
Hashable mappings
Posted Dec 5, 2025 11:45 UTC (Fri) by iabervon (subscriber, #722)Parent article: A "frozen" dictionary for Python
I'm looking forward to being able to check whether two unordered collections of mappings whose keys and values are strs are equivalent without a huge hassle. The code we've needed to consider [{"t": "a", "n": "b"}, {"t": "x", "n": "y"}] the same as both [{"t": "x", "n": "y"}, {"t": "a", "n": "b"}] and [{"n": "b", "t": "a"}, {"n": "y", "t": "x"}] (decoded from JSON) has been quite a pain. There wasn't a way to have a value built out of standard library data structures that can be accessed as expected and also makes these compare equal.
Next, I want a flag to json.loads() that causes it to return hashable values instead of mutable ones (without the caller needing to know how to accomplish that).
