[Python-3000-checkins] r58375 - python/branches/py3k/Doc/tutorial/datastructures.rst
python-3000-checkins at python.org
Mon Oct 8 16:08:36 CEST 2007
Date: Mon Oct 8 16:08:36 2007
New Revision: 58375
#1228: new comparison behavior.
--- python/branches/py3k/Doc/tutorial/datastructures.rst (original)
+++ python/branches/py3k/Doc/tutorial/datastructures.rst Mon Oct 8 16:08:36 2007
@@ -560,15 +560,8 @@
(1, 2, 3) == (1.0, 2.0, 3.0)
(1, 2, ('aa', 'ab')) < (1, 2, ('abc', 'a'), 4)
-Note that comparing objects of different types is legal. The outcome is
-deterministic but arbitrary: the types are ordered by their name. Thus, a list
-is always smaller than a string, a string is always smaller than a tuple, etc.
-[#]_ Mixed numeric types are compared according to their numeric value, so 0
-equals 0.0, etc.
-.. rubric:: Footnotes
-.. [#] The rules for comparing objects of different types should not be relied upon;
- they may change in a future version of the language.
+Note that comparing objects of different types with ``<`` or ``>`` is legal
+provided that the objects have appropriate comparison methods. For example,
+mixed numeric types are compared according to their numeric value, so 0 equals
+0.0, etc. Otherwise, rather than providing an arbitrary ordering, the
+interpreter will raise a :exc:`TypeError` exception.
More information about the Python-3000-checkins