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

Wes Turner wes.turner at gmail.com
Wed Apr 6 16:31:01 EDT 2016


On Apr 6, 2016 7:50 AM, "Random832" <random832 at fastmail.com> wrote:
>
> 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.

here's a related discussion:

[Python-ideas] Fwd: Why do equality tests between OrderedDict keys/values
views behave not as expected?

https://mail.python.org/pipermail/python-ideas/2015-December/037472.html
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20160406/f4d0b220/attachment-0001.html>


More information about the Python-ideas mailing list