]> granicus.if.org Git - python/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:46:53 +0000 (03:46 -0700)
committerGitHub <noreply@github.com>
Wed, 11 Sep 2019 10:46:53 +0000 (03:46 -0700)
(cherry picked from commit 6472ece5a0fe82809d3aa0ffb281796fcd252d76)

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

index dade2cd69fee9854f0a346e0d116b6c8e0bc40be..32bd7d2b894d7d2e588477c2d3fda0a849101640 100644 (file)
@@ -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`.