Update with pickle

Nicolas Fleury nid_oizo at yahoo.com_remove_the_
Thu May 27 09:01:54 EDT 2004


Matteo Dell'Amico wrote:

> Nicolas Fleury wrote:
> 
>> I think it is acceptable that this pickle.update function would only 
>> accept reference of same type and raise an exception otherwise.  The 
>> point of pickle.update would be to not "replace an object with another 
>> one" but to call __init__ on an existing object.
> 
> 
> I still don't understand how exactly you would want it to work. If you 
> want to call __init__ on an existing object, why don't you just do it 
> explicitly? Could you post some equivalent code to what you would want 
> pickle.update to do?

Unfortunately I can't, something like what Stefan described would be 
necessary to do it.  Basically, instead of creating a new instance, the 
pickle.update would use an existing one.  All the rest after that point 
is the same, whatever that means (fill up __dict__ or calling 
__setstate__ or whatever).  In fact, forget about what I said about 
__init__;)

Regards,
Nicolas



More information about the Python-list mailing list