On this page
inspect.getclasstree
Prev: inspect.getcallargs | Up: inspect | Next: inspect.getclosurevars
Rel: inspect.ArgInfo, inspect.Arguments, inspect.Attribute, inspect.BlockFinder
Ref: docs.python.org — inspect.getclasstree
Tags: #public #python3 #stdlib #inspect
Import
import inspect
from inspect import getclasstree
Signature & Overview
inspect.getclasstree(classes, unique=False)
Arrange the given list of classes into a hierarchy of nested lists.
Usage
import inspect
class Base: pass
class Child(Base): pass
tree = inspect.getclasstree([Base, Child], unique=True)
assert len(tree) >= 1
Gotchas
- Returns nested
(cls, bases)lists: Useful for rendering inheritance diagrams.
REPL Inspect
from inspect import getclasstree
help(getclasstree)
Linked from
Related notes
- tuts/python3/stdlib_module/inspect/getcallargs Linked here; links to this page; shared tags: #inspect, #stdlib
- tuts/python3/stdlib_module/inspect/getclosurevars Linked here; links to this page; shared tags: #inspect, #stdlib
- tuts/python3/stdlib_module/inspect Linked here; links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/inspect/ArgInfo Linked here; shared tags: #inspect, #stdlib
- tuts/python3/stdlib_module/inspect/Arguments Linked here; shared tags: #inspect, #stdlib
- tuts/python3/stdlib_module/inspect/Attribute Linked here; shared tags: #inspect, #stdlib
- tuts/python3/stdlib_module/inspect/BlockFinder Linked here; shared tags: #inspect, #stdlib
- tuts/python3/stdlib_module/inspect/BoundArguments shared tags: #inspect, #stdlib
- tuts/python3/stdlib_module/inspect/BufferFlags shared tags: #inspect, #stdlib
- tuts/python3/stdlib_module/inspect/ClassFoundException shared tags: #inspect, #stdlib