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?
>
>
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 th
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 i
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