def typestats(objects=None, shortnames=True):
 if (objects is None):
  objects = gc.get_objects()
 try:
  if shortnames:
   typename = _short_typename
  else:
   typename = _long_typename
  stats = {}
  for o in objects:
   n = typename(o)
   stats[n] = (stats.get(n, 0) + 1)
  return stats
 finally:
  del objects

def typestats ( objects = None , shortnames = True ) : if ( objects is None ) : objects = gc . get_objects ( ) try : if shortnames : typename = _short_typename else : typename = _long_typename stats = { } for o in objects : n = typename ( o ) stats [ n ] = ( stats . get ( n , 0 ) + 1 ) return stats finally : del objects
count the number of instances for each type tracked by the gc .