def visit_all_objects(f):
 ids = set()
 ls = locals()
 import inspect
 cf = inspect.currentframe()
 for o in gc.get_objects():
  if ((o is ids) or (o is ls) or (o is cf)):
   continue
  if (not (id(o) in ids)):
   ids.add(id(o))
   f(o)
  for so in gc.get_referents(o):
   if (not (id(so) in ids)):
    ids.add(id(so))
    f(so)

def visit_all_objects ( f ) : ids = set ( ) ls = locals ( ) import inspect cf = inspect . currentframe ( ) for o in gc . get_objects ( ) : if ( ( o is ids ) or ( o is ls ) or ( o is cf ) ) : continue if ( not ( id ( o ) in ids ) ) : ids . add ( id ( o ) ) f ( o ) for so in gc . get_referents ( o ) : if ( not ( id ( so ) in ids ) ) : ids . add ( id ( so ) ) f ( so )
brian and i *think* that this gets all objects .