Changeset 391 for python/trunk/Doc/library/shelve.rst
- Timestamp:
- Mar 19, 2014, 11:31:01 PM (11 years ago)
- Location:
- python/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
python/trunk
-
Property svn:mergeinfo
set to
/python/vendor/Python-2.7.6 merged eligible /python/vendor/current merged eligible
-
Property svn:mergeinfo
set to
-
python/trunk/Doc/library/shelve.rst
r2 r391 7 7 8 8 .. index:: module: pickle 9 10 **Source code:** :source:`Lib/shelve.py` 11 12 -------------- 9 13 10 14 A "shelf" is a persistent, dictionary-like object. The difference with "dbm" … … 15 19 16 20 17 .. function:: open(filename [, flag='c'[, protocol=None[, writeback=False]]])21 .. function:: open(filename, flag='c', protocol=None, writeback=False) 18 22 19 23 Open a persistent dictionary. The filename specified is the base filename for … … 41 45 mutated). 42 46 43 .. note:: 44 45 Do not rely on the shelf being closed automatically; always call 46 :meth:`close` explicitly when you don't need it any more, or use a 47 :keyword:`with` statement with :func:`contextlib.closing`. 48 47 Like file objects, shelve objects should be closed explicitly to ensure 48 that the persistent data is flushed to disk. 49 50 .. warning:: 51 52 Because the :mod:`shelve` module is backed by :mod:`pickle`, it is insecure 53 to load a shelf from an untrusted source. Like with pickle, loading a shelf 54 can execute arbitrary code. 49 55 50 56 Shelf objects support all methods supported by dictionaries. This eases the … … 97 103 98 104 99 .. class:: Shelf(dict [, protocol=None[, writeback=False]])105 .. class:: Shelf(dict, protocol=None, writeback=False) 100 106 101 107 A subclass of :class:`UserDict.DictMixin` which stores pickled values in the … … 115 121 116 122 117 .. class:: BsdDbShelf(dict [, protocol=None[, writeback=False]])123 .. class:: BsdDbShelf(dict, protocol=None, writeback=False) 118 124 119 125 A subclass of :class:`Shelf` which exposes :meth:`first`, :meth:`!next`, … … 126 132 127 133 128 .. class:: DbfilenameShelf(filename [, flag='c'[, protocol=None[, writeback=False]]])134 .. class:: DbfilenameShelf(filename, flag='c', protocol=None, writeback=False) 129 135 130 136 A subclass of :class:`Shelf` which accepts a *filename* instead of a dict-like
Note:
See TracChangeset
for help on using the changeset viewer.