diff -r f4c6dab59cd8 Doc/library/collections.abc.rst --- a/Doc/library/collections.abc.rst Tue Apr 26 17:04:18 2016 +0200 +++ b/Doc/library/collections.abc.rst Fri Aug 19 09:14:02 2016 -0400 @@ -45,9 +45,9 @@ :class:`Sized` ``__len__`` :class:`Callable` ``__call__`` -:class:`Sequence` :class:`Sized`, ``__getitem__``, ``__contains__``, ``__iter__``, ``__reversed__``, - :class:`Reversible`, ``__len__`` ``index``, and ``count`` - :class:`Container` +:class:`Sequence` :class:`Sized`, ``__getitem__``, ``__eq__``, ``__ne__``, ``__contains__``, + :class:`Reversible`, ``__len__`` ``__iter__``, ``__reversed__``, ``index``, + :class:`Container` and ``count`` :class:`MutableSequence` :class:`Sequence` ``__getitem__``, Inherited :class:`Sequence` methods and ``__setitem__``, ``append``, ``reverse``, ``extend``, ``pop``, diff -r f4c6dab59cd8 Lib/_collections_abc.py --- a/Lib/_collections_abc.py Tue Apr 26 17:04:18 2016 +0200 +++ b/Lib/_collections_abc.py Fri Aug 19 09:14:02 2016 -0400 @@ -823,6 +823,12 @@ __slots__ = () + def __eq__(self, other): + if not isinstance(other, Sequence): + return NotImplemented + return (len(self) == len(other) + and all(a == b for a, b in zip(self, other))) + @abstractmethod def __getitem__(self, index): raise IndexError diff -r f4c6dab59cd8 Lib/test/test_collections.py --- a/Lib/test/test_collections.py Tue Apr 26 17:04:18 2016 +0200 +++ b/Lib/test/test_collections.py Fri Aug 19 09:14:02 2016 -0400 @@ -1316,6 +1316,12 @@ nativeseq = ty('abracadabra') indexes = [-10000, -9999] + list(range(-3, len(nativeseq) + 3)) seqseq = SequenceSubclass(nativeseq) + + # Test __eq__ and __ne__. + self.assertEqual(seqseq, nativeseq) + self.assertNotEqual(seqseq, "hocus pocus") + + # Test index. for letter in set(nativeseq) | {'z'}: assert_index_same(nativeseq, seqseq, (letter,)) for start in range(-3, len(nativeseq) + 3):