I make a class Wrapper inherited from dict and met problem when I want to pickle it.
Is there anyway to make __getstate__ of Wrapper to output a normal dict?(Output a dict will help pickleing easily) === code === import pickle class Wrapper(dict): def __getattr__(self, attr): return self[attr] def __getstate__(self): # blablabla d=Wrapper(zip((1,2), (3,4))) pickle.dumps(d) === code === When I tried overwrite __getstate__ to below: def __getstate__(self): return self.__repr__() pickle it will shows: b'\x80...__main__...Wrapper...' <- I don't know why it shows the class name. That makes me confused. -- https://mail.python.org/mailman/listinfo/python-list