8000 Docs: reword the dbm.dumb introduction by erlend-aasland · Pull Request #114550 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

Docs: reword the dbm.dumb introduction #114550

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 9 commits into from
Jan 26, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading< 8000 /span>
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Docs: reword the dbm.dumb introduction
Also:

- consistently name the database "dumbdbm"
- fix broken dumbdbm class refs
- improve accuracy of the dbm.dump.open() spec
  • Loading branch information
erlend-aasland committed Jan 25, 2024
commit 797760ea4232354a7f4332385242f71f6ab7480c
30 changes: 16 additions & 14 deletions Doc/library/dbm.rst
Original file line number Diff line number Diff line change
Expand Up @@ -344,26 +344,28 @@ to locate the appropriate header file to simplify building this module.

--------------

The :mod:`dbm.dumb` module provides a persistent dictionary-like interface which
is written entirely in Python. Unlike other modules such as :mod:`dbm.gnu` no
external library is required. As with other persistent mappings, the keys and
values are always stored as bytes.

The module defines the following:
The :mod:`dbm.dumb` module provides a persistent :class:`dict`-like interface which
is written entirely in Python.
Unlike other :mod:`dbm` backends, such as :mod:`dbm.gnu` no,
external library is required.
As with other persistent :term:`mappings <mapping>`,
the keys and values are always stored as :class:`bytes`.

The :mod:`!dbm.dumb` module defines the following:

.. exception:: error

Raised on :mod:`dbm.dumb`-specific errors, such as I/O errors. :exc:`KeyError` is
raised for general mapping errors like specifying an incorrect key.


.. function:: open(filename[, flag[, mode]])
.. function:: open(filename, flag="c", mode=0o666)

Open a ``dumbdbm`` database and return a dumbdbm object. The *filename* argument is
the basename of the database file (without any specific extensions). When a
dumbdbm database is created, files with :file:`.dat` and :file:`.dir` extensions
are created.
Open a "dumbdbm" database and return a :class:`!dumbdbm` object.
The *filename* argument is the basename of the database file
(without any specific extensions).
When a "dumbdbm" database is created,
files with :file:`.dat` and :file:`.dir` extensions are created.

The optional *flag* argument can be:

Expand All @@ -385,7 +387,7 @@ The module defines the following:
Python's AST compiler.

.. versionchanged:: 3.5
:func:`.open` always creates a new database when the flag has the value
:func:`open` always creates a new database when the flag has the value
``'n'``.

.. versionchanged:: 3.8
Expand All @@ -397,7 +399,7 @@ The module defines the following:
Accepts :term:`path-like object` for filename.

In addition to the methods provided by the
:class:`collections.abc.MutableMapping` 6C8B class, :class:`dumbdbm` objects
:class:`collections.abc.MutableMapping` class, :class:`!dumbdbm` objects
provide the following methods:

.. method:: dumbdbm.sync()
Expand All @@ -407,5 +409,5 @@ The module defines the following:

.. method:: dumbdbm.close()

Close the ``dumbdbm`` database.
Close the "dumbdbm" database.

0