#!/usr/local/bin/python2 from itertools import chain, starmap from operator import attrgetter get_mro = attrgetter('__mro__') class A(object): pass class B(A): pass class C(object): pass class D(C): pass class E(B, D): pass for base in chain(*(base.__mro__ for base in E.__bases__)): print base for n in chain('ABC', 'DEF'): print n