248 verifyResult = AccumulatorDecorator.VERIFY_NOTHING, deepCopy = True):
249 """Function decorator, implements memoization.
250
251 Keyword arguments:
252 maxSize: maximum size for the cache associated with the function (default 128)
253 verifyResult: takes two possible values
254
255 AccumulatorDecorator.VERIFY_NOTHING - default, the cached function result is returned with no verification
256 AccumulatorDecorator.VERIFY_HASH - before returning the cached function value, the hash of the
257 result is checked to verify if this object was not modified
258 between function calls
259 deepCopy: if True (default) a deep copy of the function result will be stored in the cache.
260
261 Returns:
262 An instance of AccumulatorDecorator.
263 """
264
265 def wrapper_accumulator(func):
266 return AccumulatorDecorator(func, maxSize, verifyResult, deepCopy)
267
268 return wrapper_accumulator(func) if func else wrapper_accumulator