Pickling gotcha

George Sakkis george.sakkis at gmail.com
Fri Jun 16 03:17:31 CEST 2006


I stumbled on some weird pickling behavior that after some non-trivial
debugging time turned out to be caused by __getstate__ returning an
empty dict for some instances. As I found digging through the docs
(http://pythondoc.kldp.net/lib/pickle-inst.html), surprisingly
__setstate__ is not called nor new style instances if __getstate__
returns a false valse, without any further justification. Any pointers
on the rationale for making a special case just out of the blue ?

George




More information about the Python-list mailing list