It would be very nice to have a function in pickle to load an object without creating a new instance, but by using an existing one, meaning that __init__, etc. of an existing instance is called. Something like: updateload(object, file) (I have no patch in mind.)
Logged In: YES user_id=151545 I realize it might not be clear. What is needed is simply a function that does the same as pickle.load but that uses an existing instance instead of creating another one. All the rest after that point is the same. It means this function would raise an exception if the instance is not of the good type, etc. (Forget the part about __init__).
This functionality already exists. """ If a string is returned [from __reduce__() method], the string should be interpreted as the name of a global variable. It should be the object’s local name relative to its module; the pickle module searches the module namespace to determine the object’s module. This behaviour is typically useful for singletons. """ -- http://docs.python.org/dev/py3k/library/pickle.html