changeset: 97311:f5069e6e4229 branch: 3.4 parent: 97308:024d4f4011c9 user: Robert Collins date: Fri Aug 07 10:22:54 2015 +1200 files: Doc/reference/datamodel.rst Lib/test/test_binop.py Misc/NEWS description: Issue #4395: Better testing and documentation of binary operators. Patch by Martin Panter. diff -r 024d4f4011c9 -r f5069e6e4229 Doc/reference/datamodel.rst --- a/Doc/reference/datamodel.rst Thu Aug 06 14:03:38 2015 -0400 +++ b/Doc/reference/datamodel.rst Fri Aug 07 10:22:54 2015 +1200 @@ -1266,10 +1266,14 @@ context (e.g., in the condition of an ``if`` statement), Python will call :func:`bool` on the value to determine if the result is true or false. - There are no implied relationships among the comparison operators. The truth - of ``x==y`` does not imply that ``x!=y`` is false. Accordingly, when - defining :meth:`__eq__`, one should also define :meth:`__ne__` so that the - operators will behave as expected. See the paragraph on :meth:`__hash__` for + By default, :meth:`__ne__` delegates to :meth:`__eq__` and + inverts the result unless it is ``NotImplemented``. There are no other + implied relationships among the comparison operators, for example, + the truth of ``(x