From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Wed, 11 Sep 2019 10:46:53 +0000 (-0700) Subject: bpo-37585: Add clarification regarding comparing dict.values() (GH-14954) X-Git-Tag: v3.8.0rc1~202 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=690a16d455603500a0c6df0bd87e49c9b37a6950;p=python bpo-37585: Add clarification regarding comparing dict.values() (GH-14954) (cherry picked from commit 6472ece5a0fe82809d3aa0ffb281796fcd252d76) Co-authored-by: Kyle Stanley --- diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst index dade2cd69f..32bd7d2b89 100644 --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -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 `. + 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`.