Python: find all instances of a class with gc.get_objects()

· Adamj · July 14, 2026, 8:22 p.m.
Summary
This post discusses a useful technique for debugging Python classes by utilizing the `gc.get_objects()` function to find live instances of a class, making it easier to analyze attributes or current states without altering the class itself.
AUTHOR
Sponsored
Zulip logo Zulip
Organized team chat for people who take work seriously. Topic-based threading keeps conversations focused.
Try Zulip
Become a sponsor →