Anton81 wrote: > Hi! > > it seems that > > class Obj: > def __init__(self): > f=file("obj.dat") > self=pickle.load(f) > ... > > doesn't work. Can an object load itself with pickle from a file somehow? > What's an easy solution? > > Anton
Why are you trying to do this? Usually you would just say obj = pickle.load(f) and be done with it (you could manipulate obj after it's created, of course.) Why do you want to do obj = Obj() but have the obj come from "obj.dat"? Just curious. Peace, ~Simon -- http://mail.python.org/mailman/listinfo/python-list