From d84b29f8050f96b981dc13b2e63f7a91358c74a3 Mon Sep 17 00:00:00 2001 From: Robert Collins Date: Fri, 7 Aug 2015 10:22:54 +1200 Subject: Issue #4395: Better testing and documentation of binary operators. Patch by Martin Panter. --- Doc/reference/datamodel.rst | 22 +++++++++++++--------- Lib/test/test_binop.py | 23 ++++++++++++++++++++++- Misc/NEWS | 3 +++ 3 files changed, 38 insertions(+), 10 deletions(-) diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst index dda18ba..4acf13e 100644 --- a/Doc/reference/datamodel.rst +++ b/Doc/reference/datamodel.rst @@ -1266,10 +1266,14 @@ Basic customization 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