bpo-37585: Add clarification regarding comparing dict.values() (GH-14… · python/cpython@690a16d (original) (raw)

Original file line number Diff line number Diff line change
@@ -4343,6 +4343,14 @@ pairs within braces, for example: ``{'jack': 4098, 'sjoerd': 4127}`` or ``{4098:
4343 4343 Return a new view of the dictionary's values. See the
4344 4344 :ref:`documentation of view objects <dict-views>`.
4345 4345
4346 + An equality comparison between one ``dict.values()`` view and another
4347 + will always return ``False``. This also applies when comparing
4348 + ``dict.values()`` to itself::
4349 +
4350 + >>> d = {'a': 1}
4351 + >>> d.values() == d.values()
4352 + False
4353 +
4346 4354 Dictionaries compare equal if and only if they have the same ``(key,
4347 4355 value)`` pairs. Order comparisons ('<', '<=', '>=', '>') raise
4348 4356 :exc:`TypeError`.