bpo-37585: Add clarification to dict.values() by aeros · Pull Request #14954 · python/cpython (original) (raw)

Expand Up

@@ -4354,6 +4354,14 @@ pairs within braces, for example: ``{'jack': 4098, 'sjoerd': 4127}`` or ``{4098:

Return a new view of the dictionary's values. See the

:ref:`documentation of view objects `.

An equality comparison between one ``dict.values()`` view and another

will always return ``False``. This also applies when comparing

``dict.values()`` to itself::

>>> d = {'a': 1}

>>> d.values() == d.values()

False

Dictionaries compare equal if and only if they have the same ``(key,

value)`` pairs. Order comparisons ('<', '<=', '>=', '>') raise

:exc:`TypeError`.

Expand Down