"Yin" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I've created a class that reads in and processes a file in the > initializer __init__. The processing is fairly substantial, and thus, > instead of processing the file every time the object is created, I > pickle the object to a file. > > In subsequent creations of the object, I implement a test to see > whether the pickled file exists. If it does, then I unpickle the > object. > > Unfortunately, the __init__ cannot return this unpickled object. >
Try __new__(). http://docs.python.org/ref/customization.html This isn't the usual application of __new__, but since it returns an object it should be ideal for your purposes. -- http://mail.python.org/mailman/listinfo/python-list