def listObjs(regex='Q', typ=None):
 if (typ is not None):
  return [x for x in gc.get_objects() if isinstance(x, typ)]
 else:
  return [x for x in gc.get_objects() if re.match(regex, type(x).__name__)]

def listObjs ( regex = 'Q' , typ = None ) : if ( typ is not None ) : return [ x for x in gc . get_objects ( ) if isinstance ( x , typ ) ] else : return [ x for x in gc . get_objects ( ) if re . match ( regex , type ( x ) . __name__ ) ]
list all objects managed by python gc with class name matching regex .