getstate, setstate and pickle
Emile van Sebille
emile at fenx.com
Thu Jun 24 20:28:17 EDT 1999
I've identified my problem. pickle.py uses map(id,..) as part of its
test routine. I tried to use the same to test. map(id,...) (which
likes sequences) doesn't work on my class instances.
The script below illustrates that dumps(r) ==dumps(loads(dumps(r))) but
that r <> loads(dumps(r)).
My question now moves to: How can I test/verify my pickled data? or is
it that is the dumps match I'm ok? (sound good to me, but are there
traps?)
from pickle import *
class R:
def __init__(self):
self.a = {}
self.b = {}
print r == loads(dumps(r))
print dumps(r) == dumps(loads(dumps(r)))
regards,
--
Emile van Sebille
emile at fenx.com
-------------------
More information about the Python-list
mailing list