230 verifyResult = AccumulatorDecorator.VERIFY_NOTHING, deepCopy = True):
231 """Function decorator, implements memoization.
232
233 Keyword arguments:
234 maxSize: maximum size for the cache associated with the function (default 128)
235 verifyResult: takes two possible values
236
237 AccumulatorDecorator.VERIFY_NOTHING - default, the cached function result is returned with no verification
238 AccumulatorDecorator.VERIFY_HASH - before returning the cached function value, the hash of the
239 result is checked to verify if this object was not modified
240 between function calls
241 deepCopy: if True (default) a deep copy of the function result will be stored in the cache.
242
243 Returns:
244 An instance of AccumulatorDecorator.
245 """
246
247 def wrapper_accumulator(func):
248 return AccumulatorDecorator(func, maxSize, verifyResult, deepCopy)
249
250 return wrapper_accumulator(func) if func else wrapper_accumulator