Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
71189549
Commit
71189549
authored
May 12, 2009
by
R. David Murray
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make it clear up front that shelve only records changes
when objects are assigned back to it when writeback is False.
parent
5471a776
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
7 deletions
+11
-7
Doc/library/shelve.rst
Doc/library/shelve.rst
+11
-7
No files found.
Doc/library/shelve.rst
View file @
71189549
...
...
@@ -28,13 +28,15 @@ lots of shared sub-objects. The keys are ordinary strings.
.. 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 @@ Restrictions
interpretation as for the :class:`Shelf` class.
.. _shelve-example:
Example
-------
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment