[Python-checkins] r72572 - python/trunk/Doc/library/shelve.rst

r.david.murray python-checkins at python.org
Tue May 12 03:36:57 CEST 2009


Author: r.david.murray
Date: Tue May 12 03:36:57 2009
New Revision: 72572

Log:
Make it clear up front that shelve only records changes
when objects are assigned back to it when writeback is False.


Modified:
   python/trunk/Doc/library/shelve.rst

Modified: python/trunk/Doc/library/shelve.rst
==============================================================================
--- python/trunk/Doc/library/shelve.rst	(original)
+++ python/trunk/Doc/library/shelve.rst	Tue May 12 03:36:57 2009
@@ -28,13 +28,15 @@
    .. versionchanged:: 2.3
       The *protocol* parameter was added.
 
-   By default, mutations to persistent-dictionary mutable entries are not
-   automatically written back.  If the optional *writeback* parameter is set to
-   *True*, all entries accessed are cached in memory, and written back at close
-   time; this can make it handier to mutate mutable entries in the persistent
-   dictionary, but, if many entries are accessed, it can consume vast amounts of
-   memory for the cache, and it can make the close operation very slow since all
-   accessed entries are written back (there is no way to determine which accessed
+   Because of Python semantics, a shelf cannot know when a mutable
+   persistent-dictionary entry is modified.  By default modified objects are
+   written only when assigned to the shelf (see :ref:`shelve-example`).  If
+   the optional *writeback* parameter is set to *True*, all entries accessed
+   are cached in memory, and written back at close time; this can make it
+   handier to mutate mutable entries in the persistent dictionary, but, if
+   many entries are accessed, it can consume vast amounts of memory for the
+   cache, and it can make the close operation very slow since all accessed
+   entries are written back (there is no way to determine which accessed
    entries are mutable, nor which ones were actually mutated).
 
 Shelf objects support all methods supported by dictionaries.  This eases the
@@ -125,6 +127,8 @@
    interpretation as for the :class:`Shelf` class.
 
 
+.. _shelve-example:
+
 Example
 -------
 


More information about the Python-checkins mailing list