The implementation of Sequence interface is not sufficient to be a Sequence
Advertisements I’ve noticed that duck typing works reasonably well up to a certain point in checking whether a class is an instance of an abstract class. For example, to be an instance of collections.abc.Sized, we only need to define a __len__() method: import collections.abc class MySized: def __len__(self): return 0 assert isinstance(MySized(), collections.abc.Sized) # It… Read More The implementation of Sequence interface is not sufficient to be a Sequence