From 690a16d455603500a0c6df0bd87e49c9b37a6950 Mon Sep 17 00:00:00 2001 From: "Miss Islington (bot)" <31488909+miss-islington@users.noreply.github.com> Date: Wed, 11 Sep 2019 03:46:53 -0700 Subject: bpo-37585: Add clarification regarding comparing dict.values() (GH-14954) (cherry picked from commit 6472ece5a0fe82809d3aa0ffb281796fcd252d76) Co-authored-by: Kyle Stanley --- Doc/library/stdtypes.rst | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst index dade2cd..32bd7d2 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`. -- cgit v0.12