[LWN Logo]

From: Dieter Maurer <dieter@handshake.de>
Subject: WeakDict's: addressing CPython's problem with cyclic structures
Date: Sun, 13 Dec 98 22:28:43 GMT

WeakDict (Weak Dictionaries) have been designed to address
CPythons problems with cyclic references.
More precisely, WeakDict's allow the realization
of weak references, references that are **NOT** counted in
the reference count and can therefore be used to build
cyclic structures without obstructing the reference counting
scheme.

This might be interesting e.g. for the DOM implementation of
the XML-SIG. Other applications include object maps and
caches of various kinds.

WeakDict's are very similar to normal Python dictionaries,
with the following essential exceptions:

 - all values in a WeakDict must be instances of 'WeakValue'
   (or a derived class)

 - the reference to a value in a WeakDict is *NOT* counted
   in the reference count of the value.
   Thus, it does not prevent the value from being garbaged collected.

 - When a value is garbaged collected, the corresponding
   entry disappears from the WeakDict.

More information and download:
	URL:http://www.handshake.de/~dieter/weakdict.html

-- 
----------- comp.lang.python.announce (moderated) ----------
Article Submission Address:  python-announce@python.org
Python Language Home Page:   http://www.python.org/
Python Quick Help Index:     http://www.python.org/Help.html
------------------------------------------------------------