[Python-checkins] bpo-37585: Add clarification regarding comparing dict.values() (GH-14954)

Miss Islington (bot) webhook-mailer at python.org
Wed Sep 11 06:46:56 EDT 2019


https://github.com/python/cpython/commit/690a16d455603500a0c6df0bd87e49c9b37a6950
commit: 690a16d455603500a0c6df0bd87e49c9b37a6950
branch: 3.8
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: GitHub <noreply at github.com>
date: 2019-09-11T03:46:53-07:00
summary:

bpo-37585: Add clarification regarding comparing dict.values() (GH-14954)

(cherry picked from commit 6472ece5a0fe82809d3aa0ffb281796fcd252d76)

Co-authored-by: Kyle Stanley <aeros167 at gmail.com>

files:
M Doc/library/stdtypes.rst

diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst
index dade2cd69fee..32bd7d2b894d 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 <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`.



More information about the Python-checkins mailing list