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

Original file line number Diff line number Diff line change
@@ -4267,6 +4267,14 @@ pairs within braces, for example: ``{'jack': 4098, 'sjoerd': 4127}`` or ``{4098:
4267 4267 Return a new view of the dictionary's values. See the
4268 4268 :ref:`documentation of view objects <dict-views>`.
4269 4269
4270 + An equality comparison between one ``dict.values()`` view and another
4271 + will always return ``False``. This also applies when comparing
4272 + ``dict.values()`` to itself::
4273 +
4274 + >>> d = {'a': 1}
4275 + >>> d.values() == d.values()
4276 + False
4277 +
4270 4278 Dictionaries compare equal if and only if they have the same ``(key,
4271 4279 value)`` pairs. Order comparisons ('<', '<=', '>=', '>') raise
4272 4280 :exc:`TypeError`.