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/337439 /git.openstack. org/cgit/ openstack/ python- muranoclient/ commit/ ?id=04e0e1e553c 37114a4292af5e8 2642cdc6104555
Committed: https:/
Submitter: Jenkins
Branch: master
commit 04e0e1e553c3711 4a4292af5e82642 cdc6104555
Author: yuyafei <email address hidden>
Date: Tue Jul 5 15:31:54 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: Ia6c59f690917a7 a39d02072ceb339 779296bdb91
Closes-Bug: #1586268