[issue12445] dict view values objects are missing tp_richcmp and tp_as_number

Inada Naoki report at bugs.python.org
Thu Mar 28 09:51:17 EDT 2019


Inada Naoki <songofacandy at gmail.com> added the comment:

> Well, surely there are reasonable semantics :), because dict.values ==
> dict.values was comparable before we had view objects.

Because it was list.

Now values view is not sequence-like or set-like.

>>> {"a": "foo", "b": "bar"}.values() == {"a": "bar", "b": "foo"}.value()
True if set-like.  False if sequence-like.

If you want Python 2 behavior, you should convert it to list.
Then you can use "sequence" semantics.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue12445>
_______________________________________


More information about the Python-bugs-list mailing list