mirror of
https://github.com/python/cpython.git
synced 2025-09-27 18:59:43 +00:00
bpo-37585: Add clarification regarding comparing dict.values() (GH-14954)
This commit is contained in:
parent
4576b5431b
commit
6472ece5a0
1 changed files with 8 additions and 0 deletions
|
@ -4357,6 +4357,14 @@ pairs within braces, for example: ``{'jack': 4098, 'sjoerd': 4127}`` or ``{4098:
|
||||||
Return a new view of the dictionary's values. See the
|
Return a new view of the dictionary's values. See the
|
||||||
:ref:`documentation of view objects <dict-views>`.
|
: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,
|
Dictionaries compare equal if and only if they have the same ``(key,
|
||||||
value)`` pairs. Order comparisons ('<', '<=', '>=', '>') raise
|
value)`` pairs. Order comparisons ('<', '<=', '>=', '>') raise
|
||||||
:exc:`TypeError`.
|
:exc:`TypeError`.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue