Massimo
This is not your problem (yet) but int('01') will cause problems
because python thinks 01 is octal.
I do not see the problem in converting zip codes from int (as you
have them) into strings. zip codes must be treated as strings. You
can still do proximity searches because the fixed length ensures that
the strings are sorted in the same way as the integers.
Massimo
I suspect the problem is somewhere else. Are you using sqlite? have
you changed the type of the user_id field? It is possible there are
corrupt values in there.
Try getting a traceback.
Massimo
from cPickle import *
import copy_reg
class S(dict):
def __getattr__(self,key): return self[key]
def __setattr__(self, key, value): self[key]=value
class A(S):
def __init__(self): self.i=lambda u: u
#def __getstate__(self): return {}
def unserialize_A(d):
return A()
def serialize_A(o):
return unserialize_A, ({},)
copy_reg.pickle(A, serialize_A)
a=A()
print a.i(3)
x=dumps(a)
b=loads(x)
print b.i(4)
I guess the rule is do not trust getstate, use copy_reg instead.