summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2010-12-04 11:12:43 (GMT)
committerGeorg Brandl <georg@python.org>2010-12-04 11:12:43 (GMT)
commit732324a3f86a352217b01ae2438b6db7691ae0b1 (patch)
tree8751b652a09b2fe8ac354edd571c431210dda3b2 /Doc
parentc9fb3c64177f8efefd18a11f86bcf2f94d0f7c90 (diff)
downloadcpython-732324a3f86a352217b01ae2438b6db7691ae0b1.zip
cpython-732324a3f86a352217b01ae2438b6db7691ae0b1.tar.gz
cpython-732324a3f86a352217b01ae2438b6db7691ae0b1.tar.bz2
#7905: Actually respect the keyencoding parameter to shelve.Shelf.
Diffstat (limited to 'Doc')
-rw-r--r--Doc/library/shelve.rst15
1 files changed, 11 insertions, 4 deletions
diff --git a/Doc/library/shelve.rst b/Doc/library/shelve.rst
index 512788c..de22833 100644
--- a/Doc/library/shelve.rst
+++ b/Doc/library/shelve.rst
@@ -101,7 +101,7 @@ Restrictions
implementation used.
-.. class:: Shelf(dict, protocol=None, writeback=False)
+.. class:: Shelf(dict, protocol=None, writeback=False, keyencoding='utf-8')
A subclass of :class:`collections.MutableMapping` which stores pickled values
in the *dict* object.
@@ -115,8 +115,15 @@ Restrictions
This allows natural operations on mutable entries, but can consume much more
memory and make sync and close take a long time.
+ The *keyencoding* parameter is the encoding used to encode keys before they
+ are used with the underlying dict.
-.. class:: BsdDbShelf(dict, protocol=None, writeback=False)
+ .. versionadded:: 3.2
+ The *keyencoding* parameter; previously, keys were always encoded in
+ UTF-8.
+
+
+.. class:: BsdDbShelf(dict, protocol=None, writeback=False, keyencoding='utf-8')
A subclass of :class:`Shelf` which exposes :meth:`first`, :meth:`!next`,
:meth:`previous`, :meth:`last` and :meth:`set_location` which are available
@@ -125,8 +132,8 @@ Restrictions
modules. The *dict* object passed to the constructor must support those
methods. This is generally accomplished by calling one of
:func:`bsddb.hashopen`, :func:`bsddb.btopen` or :func:`bsddb.rnopen`. The
- optional *protocol* and *writeback* parameters have the same interpretation
- as for the :class:`Shelf` class.
+ optional *protocol*, *writeback*, and *keyencoding* parameters have the same
+ interpretation as for the :class:`Shelf` class.
.. class:: DbfilenameShelf(filename, flag='c', protocol=None, writeback=False)