[Python-ideas] Dictionary views are not entirely 'set like'

Random832 random832 at fastmail.com
Wed Apr 6 08:49:53 EDT 2016


On Wed, Apr 6, 2016, at 05:38, Joshua Morton wrote:
>     {}.keys() == {}.keys()  # 7
>     {}.items() == {}.items()  # 8
>     {}.values() == {}.values()  # 9
>     d = {}; d.values() == d.values()  # 10
> 
> True, True, False, False.
> 
> Numbers 1, 2, 4, 5 are expected behavior. 3 and 6 are not, and 7-10 is up
> for debate.[1]

Last time this came up, the conclusion was that making values views
comparable was intractable due to the fact that they're unordered but
the values themselves aren't hashable. Then the discussion got
sidetracked into a discussion of whether the justification for not
having them be hashable (Java does just fine with everything being
hashable and content-based hashes for mutable objects) makes sense in a
"consenting-adults" world.


More information about the Python-ideas mailing list