Consider having collections.abc.Sequence implement __eq__ and __ne__
Both Mapping and Set provide __eq__ and __ne__. I was wondering why not have Sequence do the same? class Sequence(Sized, Reversible, Container): def __eq__(self, other): if not isinstance(other, Sequence): return NotImplemented if len(self) != len(other): return False for a, b in self, other: if a != b: return False return True
I mean zip(self, other) On Friday, August 19, 2016 at 6:46:57 AM UTC-4, Neil Girdhar wrote:
Both Mapping and Set provide __eq__ and __ne__. I was wondering why not have Sequence do the same?
class Sequence(Sized, Reversible, Container):
def __eq__(self, other): if not isinstance(other, Sequence): return NotImplemented if len(self) != len(other): return False for a, b in self, other: if a != b: return False return True
participants (1)
-
Neil Girdhar