#!/usr/local/bin/python3 from abc import abstractmethod from collections import Container, Iterable, Mapping, Sequence, Sized class Array(Sized, Iterable, Container): __slots__ = () @abstractmethod def __getitem__(self, key): raise KeyError @classmethod def __subclasshook__(cls, C): if cls is Array: if any(('__iter__', '__len__', '__contains__') in B.__dict__.keys() for B in C.__mro__): return True return NotImplemented class C(object): def __len__(self): pass def __iter__(self): pass def __contains__(self): pass print(issubclass(C, Array)) print (C.__dict__.keys())