diff r 6386e1f4f1fd Doc/reference/expressions.rst
 a/Doc/reference/expressions.rst Tue Sep 18 07:20:18 2012 +0300
+++ b/Doc/reference/expressions.rst Fri Sep 21 22:39:51 2012 0700
@@ 1014,58 +1014,17 @@
*c*, so that, e.g., ``x < y > z`` is perfectly legal (though perhaps not
pretty).
The operators ``<``, ``>``, ``==``, ``>=``, ``<=``, and ``!=`` compare the
values of two objects. The objects need not have the same type. If both are
numbers, they are converted to a common type. Otherwise, the ``==`` and ``!=``
operators *always* consider objects of different types to be unequal, while the
``<``, ``>``, ``>=`` and ``<=`` operators raise a :exc:`TypeError` when
comparing objects of different types that do not implement these operators for
the given pair of types. You can control comparison behavior of objects of
nonbuiltin types by defining rich comparison methods like :meth:`__gt__`,
described in section :ref:`customization`.

Comparison of objects of the same type depends on the type:

* Numbers are compared arithmetically.

* The values :const:`float('NaN')` and :const:`Decimal('NaN')` are special.
 The are identical to themselves, ``x is x`` but are not equal to themselves,
 ``x != x``. Additionally, comparing any value to a notanumber value
 will return ``False``. For example, both ``3 < float('NaN')`` and
 ``float('NaN') < 3`` will return ``False``.

* Bytes objects are compared lexicographically using the numeric values of their
 elements.

* Strings are compared lexicographically using the numeric equivalents (the
 result of the builtin function :func:`ord`) of their characters. [#]_ String
 and bytes object can't be compared!

* Tuples and lists are compared lexicographically using comparison of
 corresponding elements. This means that to compare equal, each element must
 compare equal and the two sequences must be of the same type and have the same
 length.

 If not equal, the sequences are ordered the same as their first differing
 elements. For example, ``[1,2,x] <= [1,2,y]`` has the same value as
 ``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 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}``
 and {2,3} are not equal, nor subsets of one another, nor supersets of one
 another). Accordingly, sets are not appropriate arguments for functions
 which depend on total ordering. For example, :func:`min`, :func:`max`, and
 :func:`sorted` produce undefined results given a list of sets as inputs.

* Most other objects of builtin types compare unequal unless they are the same
 object; the choice whether one object is considered smaller or larger than
 another one is made arbitrarily but consistently within one execution of a
 program.
+``<``, ``>``, ``==``, ``>=``, ``<=``, and ``!=`` compare the values of two
+objects. The two objects don't necessarily have to be of the same type. With
+``==`` and ``!=``, an object is equal to itself and different objects
+(a is not b) compare unequal, unless the class of the first define a specific
+:meth:`__eq__()` and :meth:`__ne__()`. With ``<``, ``>``, ``<=``, and ``>=``,
+comparison raises a :exc:`TypeError`, unless the class of the first object
+defines specific :meth:`__lt__()`, :meth:`__gt__()`, :meth:`__le__()`, and
+:meth:`__ge__()`, or the class of the second defines the reflected method
+(:meth:`__ge__()` reflects :meth:`__lt__()`, etcetera). Builtin numbers compare
+as expected, even when of different types. Builtin sequences compare
+lexicographically.
Comparison of objects of the differing types depends on whether either
of the types provide explicit support for the comparison. Most numeric types