Skip to content

Commit

Permalink
bpo-37585: Add clarification regarding comparing dict.values() (GH-14954
Browse files Browse the repository at this point in the history
)

(cherry picked from commit 6472ece)

Co-authored-by: Kyle Stanley <aeros167@gmail.com>
  • Loading branch information
miss-islington and aeros committed Sep 11, 2019
1 parent 57491de commit 690a16d
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Doc/library/stdtypes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4343,6 +4343,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 <dict-views>`.

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

0 comments on commit 690a16d

Please sign in to comment.