It's a richer interface than the basic sequence.
Extending it generates iter(), contains(), reversed(), index(), and count().
-Unlike 'abc.Iterable'
and 'abc.Collection'
, it is not a duck type. That's why 'issubclass(MySequence, collections.abc.Sequence)'
would return 'False' even if it had all the methods defined.
+Unlike 'abc.Iterable'
and 'abc.Collection'
, it is not a duck type. That is why 'issubclass(MySequence, collections.abc.Sequence)'
would return 'False' even if it had all the methods defined.
class MyAbcSequence(collections.abc.Sequence):
def __init__(self, a):