gc.get_objects() is also pretty fun, every object in the system. For example:
def all_instances(cls):
return [o for o in gc.get_objects() if isinstance(o, cls)]
gc.get_objects() is also pretty fun, every object in the system. For example:
def all_instances(cls):
return [o for o in gc.get_objects() if isinstance(o, cls)]