简洁测试:
# python -m cProfile test.py
代码注入:
# -*- coding: utf-8 -*- class test(object): pass class test1(test): pass class test2(test1): pass print test2.__bases__ print type(test2.__bases__[0]) print test2.__bases__[0].__bases__ print getattr(test2.__bases__[0], '__bases__') print '-' * 10 def fa(ch): f_list = getattr(ch, '__bases__') for f in f_list: print f fa(f) #import inspect #print inspect.getmro(test2) if __name__ == "__main__": import cProfile cProfile.run('fa(test2)')