issubclass of abstract base class Sequence
问题 This list shows what methods you need to implement for your class to be "regarded" as Sequence: __getitem__ , __len__ , __contains__ , __iter__ , __reversed__ , index , and count . So why does this minimal implementation does not work, i.e. why issubclass(S, Sequence) is False ? from collections import * class S(object): def __getitem__(self, item): raise IndexError def __len__(self): return 0 def __contains__(self, item): return False def __iter__(self): return iter(()) def __reversed__(self