Runtime Inspection Methods

type.__subclasses__()

Return a snapshot of currently live immediate subclasses in definition order. Descendants are not recursively included; the class tracks children weakly.

Formal Syntax & Structure

python syntaxpython
Cls.__subclasses__()

Return Value

list[type]

Result of the inspection method.

Working Example

Example Snippetpython
class A: passclass B(A): passclass C(A): passclass D(B): passprint([t.__name__ for t in A.__subclasses__()])
Python Reference