]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-37585: Add clarification regarding comparing dict.values() (GH-14954)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Wed, 11 Sep 2019 10:45:54 +0000 (03:45 -0700)
committerGitHub <noreply@github.com>
Wed, 11 Sep 2019 10:45:54 +0000 (03:45 -0700)
(cherry picked from commit 6472ece5a0fe82809d3aa0ffb281796fcd252d76)

Co-authored-by: Kyle Stanley <aeros167@gmail.com>
Doc/library/stdtypes.rst

index 07282dce00d39869f2ccdaec9575aa63615cbf8e..1903864a55e20ffed67d30c8c4e243848fae8283 100644 (file)
@@ -4267,6 +4267,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`.