[Python-Dev] Quick-and-dirty weak references
M.-A. Lemburg
mal@lemburg.com
Sat, 14 Aug 1999 12:21:51 +0200
Jack Jansen wrote:
>
> This week again I was bitten by the fact that Python doesn't have any
> form of weak references, and while I was toying with some ideas I came
> up with the following quick-and-dirty scheme that I thought I'd bounce
> off this list. I might even volunteer to implement it, if people agree
> it is worth it:-)
Have you checked the weak reference dictionary implementation
by Dieter Maurer ? It's at:
http://www.handshake.de/~dieter/weakdict.html
While I like the idea of having weak references in the core,
I think 4 extra bytes for *every* object is just a little
too much. The flag bit idea (with the added global dictionary
of weak referenced objects) looks promising though.
BTW, how would this be done in JPython ? I guess it doesn't
make much sense there because cycles are no problem for the
Java VM GC.
--
Marc-Andre Lemburg
______________________________________________________________________
Y2000: 139 days left
Business: http://www.lemburg.com/
Python Pages: http://www.lemburg.com/python/