def storeCallResults(obj, verbose=False):
 results = []
 oldcall = obj.__class__.__call__
 def newcall(*args, **kwargs):
  result = oldcall(*args, **kwargs)
  results.append(result)
  if verbose:
   print(result)
  return result
 obj.__class__.__call__ = newcall
 return results

def storeCallResults ( obj , verbose = False ) : results = [ ] oldcall = obj . __class__ . __call__ def newcall ( * args , ** kwargs ) : result = oldcall ( * args , ** kwargs ) results . append ( result ) if verbose : print ( result ) return result obj . __class__ . __call__ = newcall return results
pseudo-decorate an object to store all evaluations of the function in the returned list .