[ZODB-Dev] copy.copy on Persistent object (ExtensionClass) fails.

Dieter Maurer dieter at handshake.de
Fri May 7 13:22:00 EDT 2004


Thomas Guettler wrote at 2004-5-7 09:17 +0200:
>Am Donnerstag, 6. Mai 2004 21:08 schrieb Dieter Maurer:
>> You can use pickling to get an unsharing deep copy.
>>
>> 	from cPickle import loads, dumps
>>
>> 	copy = loads(dumps(obj,1))
>>
>> Be warned, however, that this uses undocumented implementation
>> details of "dumps" that are not garanteed to always work
>> and may change across Python distributions.
> ...
>what happens to obj._p_oid, does copy get the same?

"_p_" and "_v_" attributes are discarded and do not go into
the copy.

-- 
Dieter



More information about the ZODB-Dev mailing list