__getattr__, __setattr__ and pickle

Michele Simionato michele.simionato at gmail.com
Wed Aug 13 07:21:43 EDT 2008


On Aug 12, 7:28 pm, mwojc <mw... at NOSPAMp.lodz.pl> wrote:
> Hi!
> My class with implemented __getattr__ and __setattr__ methods cannot be
> pickled because of the Error:

Another option is to define __getstate__ on your class:

def __getstate__(self): return vars(self)


   M.S.



More information about the Python-list mailing list