简洁测试:
# 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 '-' * 10def 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)')