This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: Problems with dbm documentation
Type: Stage:
Components: Documentation Versions: Python 3.0, Python 3.1
Status: closed Resolution: duplicate
Dependencies: Superseder: Add more dict methods to dbm interfaces
View: 6045
Assigned To: georg.brandl Nosy List: MLModel, georg.brandl
Priority: normal Keywords:

Created on 2009-05-05 04:19 by MLModel, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (4)
msg87208 - (view) Author: Mitchell Model (MLModel) Date: 2009-05-05 04:19
There are some problems with the dbm documentation. In the opening section:

1.  The comment before the iteration example says that .values() works,
but the method is not defined.
2.  The statement in the paragraph after the documentation of
says that the opened dbm object "supports most of the same functionality
as dictionaries". It specifically mentions keys(), but should state that
values() is not supported.
3.  I disagree with the use of the word "most" there. It does support a
minimal dictionary-like interface, but it provides only about 1/3 of the
method that dict does.
4.  The documentation should point out that keys() returns a list not a
dict_keys object.
5.  The example code shows the use of iteritems() but the documentation
doesn't mention it. In any case, there is no such method.
6.  In fact, the comment at the beginning of dbm/ states that
the interface is limited to set, get, and del using [] notation, the in
operator (and though not stated, the not in operator), and k.keys().

The Unix dbm section does state that values() and items() are not
supported, but the gdbm section does not (and should).

I hope this is all accurate. In general, the whole page should be edited
to be consistent with the actual implementation.
msg87257 - (view) Author: Mitchell Model (MLModel) Date: 2009-05-05 17:01
Further confusion:
    dbm.dumb._Database objects DO support items(), DO NOT support
iteritems(), and DO support iterkeys()

My previous comments referred to the general dbm documentation and the
specifics of dbm.gnu. I haven't checked any of this against the Unix
ndbm implementation.
msg87270 - (view) Author: Mitchell Model (MLModel) Date: 2009-05-05 18:44
And, checking the methods of dbm.ndbm, I find get() and setdefault() but
nothing like iterkeys() or iteritems(), just keys().

I think it might also be worth pointing out that a particular variation
of dbm may be chosen to create a database file by calling the
submodule's open function --,, or
msg87969 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2009-05-17 08:47
Superseded by #6045.
Date User Action Args
2022-04-11 14:56:48adminsetgithub: 50187
2009-05-17 08:47:12georg.brandlsetstatus: open -> closed
resolution: duplicate
superseder: Add more dict methods to dbm interfaces
messages: + msg87969
2009-05-05 18:44:00MLModelsetmessages: + msg87270
2009-05-05 17:01:36MLModelsetmessages: + msg87257
2009-05-05 04:19:16MLModelcreate