My understanding is that functools @cache decorator will memoize on the arguments. However for instance methods of a class, the arguments include 'self'. Would that have any performance impact?
class Test:
def __init__(self):
self.cache = {}
def test(self, a, b):
result = self.cache.get((a,b))
if result is None:
result = a + b
self.cache[(a,b)] = result
return result
Would the above perform worse than simply decorating test() with @functools.cache?