python inspect —— 檢視類的繼承體系

Inside_Zhang發表於2015-11-21

1. inspect.getmro

mro:method resolution order;

  • 檢視 defaultdict 的繼承體系:

    >> import inspect
    >> from collections import defaultdict
    
    >> inspect.getmro(defaultdict)
    (collections.defaultdict, dict, object)

相關文章