class Test(object):
def __init__(self, a):
self.a = a
def __getattr__(self, name):
return getattr(self.a, name)
from pickle import loads, dumps
loads(dumps((Test(something),)))
I got:
7 def __getattr__(self, name):
----> 8 return getattr(self.a, name)
RuntimeError: maximum recursion depth exceeded
any hint?
I can fix this by changing the code like:
if 'a' in self.__dict__:
return getattr(self.a, name)
but I don't want to. Any better solution?
Thank you