8000 Docs: rework dbm introduction by erlend-aasland · Pull Request #114551 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

Docs: rework dbm introduction #114551

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
8000
Diff view
21 changes: 11 additions & 10 deletions Doc/library/dbm.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -74,13 +75,13 @@ 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.
: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
Expand All @@ -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.

Expand Down
0