Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 09cfa89

Browse files
committed
Merged revisions 82899 via svnmerge from
svn+ssh://[email protected]/python/branches/py3k ........ r82899 | senthil.kumaran | 2010-07-15 02:00:02 +0530 (Thu, 15 Jul 2010) | 2 lines Fix issue9132 - Documentation for comparing dictionaries is out of date ........
1 parent 1ea57a6 commit 09cfa89

1 file changed

Lines changed: 3 additions & 12 deletions

File tree

Doc/reference/expressions.rst

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1026,9 +1026,9 @@ Comparison of objects of the same type depends on the type:
10261026
``x <= y``. If the corresponding element does not exist, the shorter
10271027
sequence is ordered first (for example, ``[1,2] < [1,2,3]``).
10281028

1029-
* Mappings (dictionaries) compare equal if and only if their sorted ``(key,
1030-
value)`` lists compare equal. [#]_ Outcomes other than equality are resolved
1031-
consistently, but are not otherwise defined. [#]_
1029+
* Mappings (dictionaries) compare equal if and only if they have the same
1030+
``(key, value)`` pairs. Order comparisons ``('<', '<=', '>=', '>')``
1031+
raise :exc:`TypeError`.
10321032

10331033
* Sets and frozensets define comparison operators to mean subset and superset
10341034
tests. Those relations do not define total orderings (the two sets ``{1,2}``
@@ -1310,15 +1310,6 @@ groups from right to left).
13101310
strings in a human recognizable way, compare using
13111311
:func:`unicodedata.normalize`.
13121312
1313-
.. [#] The implementation computes this efficiently, without constructing lists
1314-
or sorting.
1315-
1316-
.. [#] Earlier versions of Python used lexicographic comparison of the sorted (key,
1317-
value) lists, but this was very expensive for the common case of comparing
1318-
for equality. An even earlier version of Python compared dictionaries by
1319-
identity only, but this caused surprises because people expected to be able
1320-
to test a dictionary for emptiness by comparing it to ``{}``.
1321-
13221313
.. [#] Due to automatic garbage-collection, free lists, and the dynamic nature of
13231314
descriptors, you may notice seemingly unusual behaviour in certain uses of
13241315
the :keyword:`is` operator, like those involving comparisons between instance

0 commit comments

Comments
 (0)