[ZODB-Dev] Persistent sub-objects: noob question

Paul Winkler pw_lists at slinkp.com
Sat Jan 17 18:21:52 EST 2004


On Sat, Jan 17, 2004 at 05:42:26PM -0500, Jeremy Hylton wrote:
> On Sat, 2004-01-17 at 17:31, Paul Winkler wrote:
> > Given this class:
> > 
> > class Foo(Persistent):
> >     def __init__(self):
> >         self.bar = OOBTree()
> > 
> >     def store(self, key, value):
> >         self.bar[value] = key
> >         self._p_changed = 1  # redundant
(snip)
> > - Does it unnecessarily cause a copy of the whole Foo 
> > instance to be saved?  
> 
> Yes.

thought so :-)

> > - Or does it cause an unnecessary copy of the entire OOBTree
> > to be saved?
> 
> No.  The BTree is already marked as change.  More specifically, some
> part of the BTree is marked as changed.  For a large tree, it will
> usually mark just a single bucket as changed.

OK, so then self._p_changed = 1 only affects
non-Persistent attributes?

-- 

Paul Winkler
http://www.slinkp.com
Look! Up in the sky! It's TOFU FELLATOR STALKER!
(random hero from isometric.spaceninja.com)



More information about the ZODB-Dev mailing list