What about not storing args at all? Something like this:
def cache_function(func, args_list):
cache = {}
def cached_result(*args, **kwargs):
kwargs.update(dict(zip(args_list, args)))
if kwargs in cache:
return cache[kwargs]
result = func(**kwargs)
cache[kwargs] = result
return result
return cached_resultargs_list is a list of all the argument names, so that they can be converted into keyword arguments. -- http://mail.python.org/mailman/listinfo/python-list
