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

Brett Cannon webhook-mailer at python.org
Wed Sep 11 06:01:46 EDT 2019


https://github.com/python/cpython/commit/6472ece5a0fe82809d3aa0ffb281796fcd252d76
commit: 6472ece5a0fe82809d3aa0ffb281796fcd252d76
branch: master
author: Kyle Stanley <aeros167 at gmail.com>
committer: Brett Cannon <54418+brettcannon at users.noreply.github.com>
date: 2019-09-11T11:01:41+01:00
summary:

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

files:
M Doc/library/stdtypes.rst

diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst
index 0a565c3e5b6b..c78f4ba8f068 100644
--- a/Doc/library/stdtypes.rst
+++ b/Doc/library/stdtypes.rst
@@ -4357,6 +4357,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