From f7cb35a4b3f595ef835cbe5d4af85169f96f0875 Mon Sep 17 00:00:00 2001 From: "Erlend E. Aasland" Date: Thu, 25 Jan 2024 11:35:03 +0100 Subject: [PATCH 1/2] Docs: rework dbm introduction - add refs to other parts of the docs (dict, bytes, etc.) - clarify whichdb() return value by using list markup - silence refs to example or generic submodule methods (keys, get, etc.) --- Doc/library/dbm.rst | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/Doc/library/dbm.rst b/Doc/library/dbm.rst index eca1c25602a018..615a3ea9e190ad 100644 --- a/Doc/library/dbm.rst +++ b/Doc/library/dbm.rst @@ -28,10 +28,11 @@ the Oracle Berkeley DB. available --- :mod:`dbm.gnu`, :mod:`dbm.ndbm` or :mod:`dbm.dumb` --- should be used to open a given file. - Returns one of the following values: ``None`` if the file can't be opened - because it's unreadable or doesn't exist; the empty string (``''``) if the - file's format can't be guessed; or a string containing the required module - name, such as ``'dbm.ndbm'`` or ``'dbm.gnu'``. + Return one of the following values: + + * ``None`` if the file can't be opened because it's unreadable or doesn't exist + * the empty string (``''``) if the file's format can't be guessed + * a string containing the required module name, such as ``'dbm.ndbm'`` or ``'dbm.gnu'`` .. versionchanged:: 3.11 Accepts :term:`path-like object` for filename. @@ -74,10 +75,10 @@ the Oracle Berkeley DB. modified by the prevailing umask). -The object returned by :func:`.open` supports the same basic functionality as -dictionaries; keys and their corresponding values can be stored, retrieved, and -deleted, and the :keyword:`in` operator and the :meth:`keys` method are -available, as well as :meth:`get` and :meth:`setdefault`. +The object returned by :func:`open` supports the same basic functionality as a +:class:`dict`; keys and their corresponding values can be stored, retrieved, and +deleted, and the :keyword:`in` operator and the :meth:`!keys` method are +available, as well as :meth:`!get` and :meth:`!setdefault`. .. versionchanged:: 3.2 :meth:`get` and :meth:`setdefault` are now available in all database modules. @@ -89,7 +90,7 @@ available, as well as :meth:`get` and :meth:`setdefault`. .. versionchanged:: 3.11 Accepts :term:`path-like object` for file. -Key and values are always stored as bytes. This means that when +Key and values are always stored as :class:`bytes`. This means that when strings are used they are implicitly converted to the default encoding before being stored. From 8872104ba34f43a742d9a5ddf4811fbe1c85252d Mon Sep 17 00:00:00 2001 From: "Erlend E. Aasland" Date: Fri, 26 Jan 2024 09:56:12 +0100 Subject: [PATCH 2/2] Update Doc/library/dbm.rst --- Doc/library/dbm.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/library/dbm.rst b/Doc/library/dbm.rst index 615a3ea9e190ad..c0d85c560ade20 100644 --- a/Doc/library/dbm.rst +++ b/Doc/library/dbm.rst @@ -81,7 +81,7 @@ deleted, and the :keyword:`in` operator and the :meth:`!keys` method are available, as well as :meth:`!get` and :meth:`!setdefault`. .. versionchanged:: 3.2 - :meth:`get` and :meth:`setdefault` are now available in all database modules. + :meth:`!get` and :meth:`!setdefault` are now available in all database modules. .. versionchanged:: 3.8 Deleting a key from a read-only database raises database module specific error