mirror of
https://github.com/python/cpython.git
synced 2025-09-29 11:45:57 +00:00
Merged revisions 72572 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r72572 | r.david.murray | 2009-05-11 21:36:57 -0400 (Mon, 11 May 2009) | 3 lines Make it clear up front that shelve only records changes when objects are assigned back to it when writeback is False. ........
This commit is contained in:
parent
4eb88b3baa
commit
ff85bcac22
1 changed files with 11 additions and 7 deletions
|
@ -25,13 +25,15 @@ lots of shared sub-objects. The keys are ordinary strings.
|
||||||
By default, version 3 pickles are used to serialize values. The version of the
|
By default, version 3 pickles are used to serialize values. The version of the
|
||||||
pickle protocol can be specified with the *protocol* parameter.
|
pickle protocol can be specified with the *protocol* parameter.
|
||||||
|
|
||||||
By default, mutations to persistent-dictionary mutable entries are not
|
Because of Python semantics, a shelf cannot know when a mutable
|
||||||
automatically written back. If the optional *writeback* parameter is set to
|
persistent-dictionary entry is modified. By default modified objects are
|
||||||
*True*, all entries accessed are cached in memory, and written back at close
|
written only when assigned to the shelf (see :ref:`shelve-example`). If
|
||||||
time; this can make it handier to mutate mutable entries in the persistent
|
the optional *writeback* parameter is set to *True*, all entries accessed
|
||||||
dictionary, but, if many entries are accessed, it can consume vast amounts of
|
are cached in memory, and written back at close time; this can make it
|
||||||
memory for the cache, and it can make the close operation very slow since all
|
handier to mutate mutable entries in the persistent dictionary, but, if
|
||||||
accessed entries are written back (there is no way to determine which accessed
|
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).
|
entries are mutable, nor which ones were actually mutated).
|
||||||
|
|
||||||
Shelf objects support all methods supported by dictionaries. This eases the
|
Shelf objects support all methods supported by dictionaries. This eases the
|
||||||
|
@ -118,6 +120,8 @@ Restrictions
|
||||||
interpretation as for the :class:`Shelf` class.
|
interpretation as for the :class:`Shelf` class.
|
||||||
|
|
||||||
|
|
||||||
|
.. _shelve-example:
|
||||||
|
|
||||||
Example
|
Example
|
||||||
-------
|
-------
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue