Code
Hub
Workspaces
Following
Digest
Agents
Trending
Connect
MCP
copy
Index your code
hub
/
github.com/fluentpython/example-code-2e
/ subclasses
Function
subclasses
17-it-generator/tree/classtree/classtree.py:14–18 ·
view source on GitHub ↗
(cls)
Source
from the content-addressed store, hash-verified
12
13
14
def
subclasses(cls):
15
try
:
16
return
cls.__subclasses__()
17
except
TypeError:
# handle the `type` type
18
return
cls.__subclasses__(cls)
19
20
21
def
tree(cls, level=0, last_sibling=True):
Callers
3
test_subclasses
Function · 0.90
test_subclasses_of_type
Function · 0.90
tree
Function · 0.70
Calls
no outgoing calls
Tested by
2
test_subclasses
Function · 0.72
test_subclasses_of_type
Function · 0.72