[ZODB-Dev] Writing Persistent Class

Dieter Maurer dieter at handshake.de
Mon Jan 21 13:15:42 EST 2008


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.

If you are lucky, then the ZODB recognizes the problem (because,
it is unable to store two different objects (the result of the "deepcopy")
with the same oid in its cache.



-- 
Dieter


More information about the ZODB-Dev mailing list