def unbound_cache(func):
 cache = {}
 @wraps(func)
 def caching_wrapper(*args):
  try:
   return cache[args]
  except KeyError:
   result = func(*args)
   cache[args] = result
   return result
 return caching_wrapper

def unbound_cache ( func ) : cache = { } @ wraps ( func ) def caching_wrapper ( * args ) : try : return cache [ args ] except KeyError : result = func ( * args ) cache [ args ] = result return result return caching_wrapper
caching decorator with an unbounded cache size .