Miscellany
public python v1 · immutabledef pobj(): import gc from types import ClassType gc.collect() objects = gc.get_objects() print "%d objects:" % (len(objects),) instances = {} for obj in objects: if isinstance(obj, object) and type(obj) is not ClassType: cls = obj.__class__ instances[cls] = instances.get(cls, 0) +1 for t, c in instances.items(): print "%6d :: %s" % (c, t)