[Python-ideas] Consider having collections.abc.Sequence implement __eq__ and __ne__
Neil Girdhar
mistersheik at gmail.com
Fri Aug 19 06:46:57 EDT 2016
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20160819/8381c3a4/attachment.html>
More information about the Python-ideas
mailing list