[Chicago] problem with __getstate__

Massimo Di Pierro mdipierro at cs.depaul.edu
Sun May 18 20:44:59 CEST 2008


does anybody know why the following code does not work?

     from cPickle import *

     class S(dict):
         def __setattr__(self, key, value): self[key]=value
     class A(S):
        def __init__(self): self.i=lambda u: u
        def __getstate__(self): return {}

     a=A()
     x=dumps(a)

I know that self.i is a lambda and thus not pickable but __getstate__  
is called (I checked) and thus it should not matter. I guess I do not  
undretansd how pickling under inheritance.

Massimo


More information about the Chicago mailing list