[Mesa-dev] [PATCH 12/26] python: Fix unequality comparisons
bochecha at daitauha.fr
Fri Jul 6 09:25:53 UTC 2018
On Thu, 2018-07-05 at 09:10 -0700, Dylan Baker wrote:
> Quoting Mathieu Bridon (2018-07-05 06:17:43)
> > + def __ne__(self, other):
> > + return not self.__eq__(other)
> This can be written as "not (self == other)", right?
It can, yes.
The `==` operator is going to end up calling the `__eq__` method
defined just above anyway, and we're already in the implementation
details of `__ne__`.
So it felt more natural to me to have `__ne__` be the opposite of
`__eq__` rather than the opposite of `==`.
Also, `not (… == …)` feels weird, it screams "replace me by `… != …`".
Which I'm worried someone not paying attention might do in the future.
I don't feel very strongly about it though, so I'll change it if you
More information about the mesa-dev