summaryrefslogtreecommitdiffstats
path: root/Doc/library/weakref.rst
diff options
context:
space:
mode:
authorChristian Heimes <christian@cheimes.de>2007-12-02 15:22:16 (GMT)
committerChristian Heimes <christian@cheimes.de>2007-12-02 15:22:16 (GMT)
commitd8654cf758c730af430026a5b20810bebceba4d7 (patch)
treecba77a4cce70773ed2bf00d183459101c53dfd26 /Doc/library/weakref.rst
parentb27ce7e46843841e8e8f2c9e5108044d022ae248 (diff)
downloadcpython-d8654cf758c730af430026a5b20810bebceba4d7.zip
cpython-d8654cf758c730af430026a5b20810bebceba4d7.tar.gz
cpython-d8654cf758c730af430026a5b20810bebceba4d7.tar.bz2
Merged revisions 59259-59274 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r59260 | lars.gustaebel | 2007-12-01 22:02:12 +0100 (Sat, 01 Dec 2007) | 5 lines Issue #1531: Read fileobj from the current offset, do not seek to the start. (will backport to 2.5) ........ r59262 | georg.brandl | 2007-12-01 23:24:47 +0100 (Sat, 01 Dec 2007) | 4 lines Document PyEval_* functions from ceval.c. Credits to Michael Sloan from GHOP. ........ r59263 | georg.brandl | 2007-12-01 23:27:56 +0100 (Sat, 01 Dec 2007) | 2 lines Add a few refcount data entries. ........ r59264 | georg.brandl | 2007-12-01 23:38:48 +0100 (Sat, 01 Dec 2007) | 4 lines Add test suite for cmd module. Written by Michael Schneider for GHOP. ........ r59265 | georg.brandl | 2007-12-01 23:42:46 +0100 (Sat, 01 Dec 2007) | 3 lines Add examples to the ElementTree documentation. Written by h4wk.cz for GHOP. ........ r59266 | georg.brandl | 2007-12-02 00:12:45 +0100 (Sun, 02 Dec 2007) | 3 lines Add "Using Python on Windows" document, by Robert Lehmann. Written for GHOP. ........ r59271 | georg.brandl | 2007-12-02 15:34:34 +0100 (Sun, 02 Dec 2007) | 3 lines Add example to mmap docs. Written for GHOP by Rafal Rawicki. ........ r59272 | georg.brandl | 2007-12-02 15:37:29 +0100 (Sun, 02 Dec 2007) | 2 lines Convert bdb.rst line endings to Unix style. ........ r59274 | georg.brandl | 2007-12-02 15:58:50 +0100 (Sun, 02 Dec 2007) | 4 lines Add more entries to the glossary. Written by Jeff Wheeler for GHOP. ........
Diffstat (limited to 'Doc/library/weakref.rst')
-rw-r--r--Doc/library/weakref.rst32
1 files changed, 16 insertions, 16 deletions
diff --git a/Doc/library/weakref.rst b/Doc/library/weakref.rst
index 9a1e076..fdfbae0 100644
--- a/Doc/library/weakref.rst
+++ b/Doc/library/weakref.rst
@@ -20,22 +20,22 @@ In the following, the term :dfn:`referent` means the object which is referred to
by a weak reference.
A weak reference to an object is not enough to keep the object alive: when the
-only remaining references to a referent are weak references, garbage collection
-is free to destroy the referent and reuse its memory for something else. A
-primary use for weak references is to implement caches or mappings holding large
-objects, where it's desired that a large object not be kept alive solely because
-it appears in a cache or mapping. For example, if you have a number of large
-binary image objects, you may wish to associate a name with each. If you used a
-Python dictionary to map names to images, or images to names, the image objects
-would remain alive just because they appeared as values or keys in the
-dictionaries. The :class:`WeakKeyDictionary`, :class:`WeakValueDictionary`
-and :class:`WeakSet` classes supplied by the :mod:`weakref` module are an
-alternative, using weak references to construct mappings that don't keep objects
-alive solely because they appear in the container objects.
-If, for example, an image object is a value in a :class:`WeakValueDictionary`,
-then when the last remaining references to that image object are the weak
-references held by weak mappings, garbage collection can reclaim the object,
-and its corresponding entries in weak mappings are simply deleted.
+only remaining references to a referent are weak references,
+:term:`garbage collection` is free to destroy the referent and reuse its memory
+for something else. A primary use for weak references is to implement caches or
+mappings holding large objects, where it's desired that a large object not be
+kept alive solely because it appears in a cache or mapping. For example, if you
+have a number of large binary image objects, you may wish to associate a name
+with each. If you used a Python dictionary to map names to images, or images to
+names, the image objects would remain alive just because they appeared as values
+or keys in the dictionaries. The :class:`WeakKeyDictionary` and
+:class:`WeakValueDictionary` classes supplied by the :mod:`weakref` module are
+an alternative, using weak references to construct mappings that don't keep
+objects alive solely because they appear in the mapping objects. If, for
+example, an image object is a value in a :class:`WeakValueDictionary`, then when
+the last remaining references to that image object are the weak references held
+by weak mappings, garbage collection can reclaim the object, and its
+corresponding entries in weak mappings are simply deleted.
:class:`WeakKeyDictionary` and :class:`WeakValueDictionary` use weak references
in their implementation, setting up callback functions on the weak references