changeset: 97313:e56893df8e76 parent: 97310:e54c684e6788 parent: 97312:b9a0165a3de8 user: Robert Collins date: Fri Aug 07 10:34:23 2015 +1200 files: Misc/NEWS description: Issue #4395: Better testing and documentation of binary operators. Patch by Martin Panter. diff -r e54c684e6788 -r e56893df8e76 Doc/reference/datamodel.rst --- a/Doc/reference/datamodel.rst Thu Aug 06 14:04:30 2015 -0400 +++ b/Doc/reference/datamodel.rst Fri Aug 07 10:34:23 2015 +1200 @@ -1276,10 +1276,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