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

(cherry picked from commit 6472ece5a0)

Co-authored-by: Kyle Stanley <aeros167@gmail.com>
This commit is contained in:
Miss Islington (bot) 2019-09-11 03:46:53 -07:00 committed by GitHub
parent 57491de7c3
commit 690a16d455
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View 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`.