Do not change the arguments of the function when memoizing

This commit is contained in:
C. R. Oldham 2017-08-02 13:44:32 -06:00
parent 4c1d931654
commit a260e913b5

View file

@ -251,9 +251,8 @@ def memoize(func):
str_args.append(str(arg))
else:
str_args.append(arg)
args = str_args
args_ = ','.join(list(args) + ['{0}={1}'.format(k, kwargs[k]) for k in sorted(kwargs)])
args_ = ','.join(list(str_args) + ['{0}={1}'.format(k, kwargs[k]) for k in sorted(kwargs)])
if args_ not in cache:
cache[args_] = func(*args, **kwargs)
return cache[args_]