[ZODB-Dev] weakref and Persistent

Phillip J. Eby pje at telecommunity.com
Wed Apr 23 17:10:51 EDT 2003


At 04:02 PM 4/23/03 -0400, Jeremy Hylton wrote:
>On Wed, 23 Apr 2003 15:54:23 -0400
>  "Phillip J. Eby" <pje at telecommunity.com> wrote:
> >
> > Looks like you already did it in ZODB4:
>
>Oh, right ;-).
>
>In ZODB4, instances of Persistent classes are just
>instances.  So they get weakref-ability from type.

And a good thing too; I use WeakValueDictionary to cache persistent 
instances in PEAK.  ZODB4's persistence.cache module uses weakrefs, too.

So, I guess this should be a good indication that persistent objects will 
be potentially weakref-able under ZODB4.  (I say potentially, because 
Persistent subclasses that define '__slots__' and don't inherit from an 
already weakref-able base class, will not be weakref-able.)

Also, this is a whole separate question from whether you can *persist* weak 
references, which is another whole kettle of fish of a different color that 
need to be caught with a fresh can of worms.  :)




More information about the ZODB-Dev mailing list