Re: [Mesa-dev] [PATCH 12/26] python: Fix unequality comparisons

2018-08-07 Thread Dylan Baker
Quoting Mathieu Bridon (2018-07-06 02:25:53) > 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? > >

Re: [Mesa-dev] [PATCH 12/26] python: Fix unequality comparisons

2018-07-06 Thread Mathieu Bridon
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

Re: [Mesa-dev] [PATCH 12/26] python: Fix unequality comparisons

2018-07-05 Thread Dylan Baker
Quoting Mathieu Bridon (2018-07-05 06:17:43) > On Python 3, executing `foo != bar` will first try to call > foo.__ne__(bar), and fallback on the opposite result of foo.__eq__(bar). > > Python 2 does not do that. > > As a result, those __eq__ methods were never called, when we were > testing for

[Mesa-dev] [PATCH 12/26] python: Fix unequality comparisons

2018-07-05 Thread Mathieu Bridon
On Python 3, executing `foo != bar` will first try to call foo.__ne__(bar), and fallback on the opposite result of foo.__eq__(bar). Python 2 does not do that. As a result, those __eq__ methods were never called, when we were testing for inequality. Expliclty adding the __ne__ methods fixes this