summaryrefslogtreecommitdiffstats
path: root/Doc/reference
diff options
context:
space:
mode:
authorSenthil Kumaran <orsenthil@gmail.com>2010-07-14 20:32:56 (GMT)
committerSenthil Kumaran <orsenthil@gmail.com>2010-07-14 20:32:56 (GMT)
commit09cfa890d2258e4b969fd338293a068f48e899d4 (patch)
tree8a371c082ae194c8750628c06206889d883e2f6b /Doc/reference
parent1ea57a6c5f3a78dd28349dbb58639385cc53788a (diff)
downloadcpython-09cfa890d2258e4b969fd338293a068f48e899d4.zip
cpython-09cfa890d2258e4b969fd338293a068f48e899d4.tar.gz
cpython-09cfa890d2258e4b969fd338293a068f48e899d4.tar.bz2
Merged revisions 82899 via svnmerge from
svn+ssh://pythondev@svn.python.org/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 ........
Diffstat (limited to 'Doc/reference')
-rw-r--r--Doc/reference/expressions.rst15
1 files changed, 3 insertions, 12 deletions
diff --git a/Doc/reference/expressions.rst b/Doc/reference/expressions.rst
index f0bf841..dff9cc3 100644
--- a/Doc/reference/expressions.rst
+++ b/Doc/reference/expressions.rst
@@ -1026,9 +1026,9 @@ Comparison of objects of the same type depends on the type:
``x <= y``. If the corresponding element does not exist, the shorter
sequence is ordered first (for example, ``[1,2] < [1,2,3]``).
-* Mappings (dictionaries) compare equal if and only if their sorted ``(key,
- value)`` lists compare equal. [#]_ Outcomes other than equality are resolved
- consistently, but are not otherwise defined. [#]_
+* Mappings (dictionaries) compare equal if and only if they have the same
+ ``(key, value)`` pairs. Order comparisons ``('<', '<=', '>=', '>')``
+ raise :exc:`TypeError`.
* Sets and frozensets define comparison operators to mean subset and superset
tests. Those relations do not define total orderings (the two sets ``{1,2}``
@@ -1310,15 +1310,6 @@ groups from right to left).
strings in a human recognizable way, compare using
:func:`unicodedata.normalize`.
-.. [#] The implementation computes this efficiently, without constructing lists
- or sorting.
-
-.. [#] Earlier versions of Python used lexicographic comparison of the sorted (key,
- value) lists, but this was very expensive for the common case of comparing
- for equality. An even earlier version of Python compared dictionaries by
- identity only, but this caused surprises because people expected to be able
- to test a dictionary for emptiness by comparing it to ``{}``.
-
.. [#] Due to automatic garbage-collection, free lists, and the dynamic nature of
descriptors, you may notice seemingly unusual behaviour in certain uses of
the :keyword:`is` operator, like those involving comparisons between instance