[Zope3-dev] zodb __parent__ and weakref

Chris Withers chris at simplistix.co.uk
Fri Feb 17 18:37:11 EST 2006

Shaun Cutts wrote:
> When a container gets pickled to be put into zodb, what happens to the
> subtree? 

If the container has references to stuff that is contains, one of two 
things could happen:

1. If the contents subclass persistent, then they will end up in their 
own pickle in the zodb and will be made persistent

2. If they don't, they will still be persisted but will end up in the 
container's pickle in the zodb.

> Is it just left as a big "clump of stuff" for the garbage
> collector to deal with? 

As with all object, not until nothing references it ;-)

> If so, maybe __parent__ should be a weakref,

Well, if you respect the interface, that's your choice. Not sure a 
weakref can respect the interface though...

> because tracing around all of the cycles in the tree by the gc must
> surely be inefficient, and using a weakref here should make the subtrees
> "dissolve" more easily.

Why dissolve?



Simplistix - Content Management, Zope & Python Consulting
            - http://www.simplistix.co.uk

More information about the Zope3-dev mailing list