8000 Docs: rework dbm introduction (#114551) · python/cpython@65cf5dc · GitHub
[go: up one dir, main page]

Skip to content

Commit 65cf5dc

Browse files
Docs: rework dbm introduction (#114551)
- 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.)
1 parent dcd28b5 commit 65cf5dc

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

Doc/library/dbm.rst

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,11 @@ the Oracle Berkeley DB.
2828
available --- :mod:`dbm.gnu`, :mod:`dbm.ndbm` or :mod:`dbm.dumb` --- should
2929
be used to open a given file.
3030

31-
Returns one of the following values: ``None`` if the file can't be opened
32-
because it's unreadable or doesn't exist; the empty string (``''``) if the
33-
file's format can't be guessed; or a string containing the required module
34-
name, such as ``'dbm.ndbm'`` or ``'dbm.gnu'``.
31+
Return one of the following values:
32+
33+
* ``None`` if the file can't be opened because it's unreadable or doesn't exist
34+
* the empty string (``''``) if the file's format can't be guessed
35+
* a string containing the required module name, such as ``'dbm.ndbm'`` or ``'dbm.gnu'``
3536

3637
.. versionchanged:: 3.11
3738
Accepts :term:`path-like object` for filename.
@@ -74,13 +75,13 @@ the Oracle Berkeley DB.
7475
modified by the prevailing umask).
7576

7677

77-
The object returned by :func:`.open` supports the same basic functionality as
78-
dictionaries; keys and their corresponding values can be stored, retrieved, and
79-
deleted, and the :keyword:`in` operator and the :meth:`keys` method are
80-
available, as well as :meth:`get` and :meth:`setdefault`.
78+
The object returned by :func:`open` supports the same basic functionality as a
79+
:class:`dict`; keys and their corresponding values can be stored, retrieved, and
80+
deleted, and the :keyword:`in` operator and the :meth:`!keys` method are
81+
available, as well as :meth:`!get` and :meth:`!setdefault`.
8182

8283
.. versionchanged:: 3.2
83-
:meth:`get` and :meth:`setdefault` are now available in all database modules.
84+
:meth:`!get` and :meth:`!setdefault` are now available in all database modules.
8485

8586
.. versionchanged:: 3.8
8687
Deleting a key from a read-only database raises database module specific error
@@ -89,7 +90,7 @@ available, as well as :meth:`get` and :meth:`setdefault`.
8990
.. versionchanged:: 3.11
9091
Accepts :term:`path-like object` for file.
9192

92-
Key and values are always stored as bytes. This means that when
93+
Key and values are always stored as :class:`bytes`. This means that when
9394
strings are used they are implicitly converted to the default encoding before
9495
being stored.
9596

0 commit comments

Comments
 (0)
0