Issue 960821: Add an updating load function in pickle (original) (raw)

Created on 2004-05-26 13:34 by nidoizo, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (5)
msg61167 - (view) Author: Nicolas Fleury (nidoizo) Date: 2004-05-26 13:34
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.)
msg61168 - (view) Author: Nicolas Fleury (nidoizo) Date: 2004-05-27 13:04
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__).
msg81439 - (view) Author: Daniel Diniz (ajaksu2) * (Python triager) Date: 2009-02-09 06:14
Any real use cases beyond being very nice?
msg108890 - (view) Author: Alexander Belopolsky (belopolsky) * (Python committer) Date: 2010-06-29 02:55
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
msg109207 - (view) Author: Alexander Belopolsky (belopolsky) * (Python committer) Date: 2010-07-04 04:42
On the second reading, OP's request has nothing to do with pickle.load(). In fact, there is no coherent request here.
History
Date User Action Args
2022-04-11 14:56:04 admin set github: 40292
2010-07-04 04:42:54 belopolsky set status: pending -> closedmessages: +
2010-06-29 02:55:28 belopolsky set status: open -> pendingnosy: + belopolskymessages: + assignee: belopolskyresolution: not a bug
2009-02-09 06:14:00 ajaksu2 set nosy: + ajaksu2messages: + versions: + Python 3.1, Python 2.7
2004-05-26 13:34:50 nidoizo create