Marius Gedminas wrote at 2008-1-23 23:19 +0200:
>On Mon, Jan 21, 2008 at 07:15:42PM +0100, Dieter Maurer wrote:
>> Marius Gedminas wrote at 2008-1-21 00:08 +0200:
>> >Personally, I'd be afraid to use deepcopy on a persistent object.
>> A deepcopy is likely to be no copy at all.
>> As Python's "deepcopy" does not know about object ids, it is likely
>> that the copy result uses the same oids as the original.
>> When you store this copy, objects with the same oid are identified.
>This appears not to be the case. The following script prints "Looks OK":
You are right -- and I do now understand why.
"deepcopy" uses "__getstate__" to get at the object's state.
"Persistent.__getstate__" does not include the special persistent
attributes. Most of the "_p_" and all "_v_" attributes are not included.
For more information about ZODB, see the ZODB Wiki:
ZODB-Dev mailing list - ZODB-Dev@zope.org