Index: Doc/reference/expressions.rst =================================================================== --- Doc/reference/expressions.rst (revision 66303) +++ Doc/reference/expressions.rst (working copy) @@ -1003,17 +1003,14 @@ 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, objects of different -types *always* compare unequal, and are ordered consistently but arbitrarily. -You can control comparison behavior of objects of non-builtin types by defining -a :meth:`__cmp__` method or rich comparison methods like :meth:`__gt__`, -described in section :ref:`specialnames`. +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. You can control comparison +behavior of objects of non-builtin types by defining a :meth:`__cmp__` method +or rich comparison methods like :meth:`__gt__`, described in section +:ref:`specialnames`. -(This unusual definition of comparison was used to simplify the definition of -operations like sorting and the :keyword:`in` and :keyword:`not in` operators. -In the future, the comparison rules for objects of different types are likely to -change.) - Comparison of objects of the same type depends on the type: * Numbers are compared arithmetically.