In Python 3 __ne__ by default delegates to __eq__ and inverts the
result, but in Python 2 they urge you to define __ne__ when you
define __eq__ for it to work properly [1].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
__eq__(), one should also define __ne__() so that the operators
will behave as expected.
[1]https://docs.python.org/2/reference/datamodel.html#object.__ne__
Reviewed: https:/ /review. openstack. org/337432 /git.openstack. org/cgit/ openstack/ python- congressclient/ commit/ ?id=ec6abb3dbe4 9d704372b07f4fc a6918fd00324fe
Committed: https:/
Submitter: Jenkins
Branch: master
commit ec6abb3dbe49d70 4372b07f4fca691 8fd00324fe
Author: yuyafei <email address hidden>
Date: Tue Jul 5 15:12:38 2016 +0800
Add __ne__ built-in function
In Python 3 __ne__ by default delegates to __eq__ and inverts the /docs.python. org/2/reference /datamodel. html#object. __ne__
result, but in Python 2 they urge you to define __ne__ when you
define __eq__ for it to work properly [1].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
__eq__(), one should also define __ne__() so that the operators
will behave as expected.
[1]https:/
Change-Id: I50234892bd3dad cda533d97c03414 067e06ef0f4
Closes-Bug: #1586268