annotate Doc/lib/libdbm.tex @ 5817:48b94de85bf3 legacy-trunk

Extensive changes by AMK.
author Guido van Rossum <guido@python.org>
date Thu, 17 Jul 1997 16:29:42 +0000
parents b218f294b726
children 3468ea8645ca
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
1 \section{Built-in Module \sectcode{dbm}}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
2 \bimodindex{dbm}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
3
4728
b218f294b726 (lib<all sorts of stuff>.tex):
Fred Drake <fdrake@acm.org>
parents: 2814
diff changeset
4 The \code{dbm} module provides an interface to the \UNIX{}
2814
c6fe80ce7c20 documented default flag, mode; changed gdbm into a pointer to dbm
Guido van Rossum <guido@python.org>
parents: 2647
diff changeset
5 \code{(n)dbm} library. Dbm objects behave like mappings
c6fe80ce7c20 documented default flag, mode; changed gdbm into a pointer to dbm
Guido van Rossum <guido@python.org>
parents: 2647
diff changeset
6 (dictionaries), except that keys and values are always strings.
c6fe80ce7c20 documented default flag, mode; changed gdbm into a pointer to dbm
Guido van Rossum <guido@python.org>
parents: 2647
diff changeset
7 Printing a dbm object doesn't print the keys and values, and the
c6fe80ce7c20 documented default flag, mode; changed gdbm into a pointer to dbm
Guido van Rossum <guido@python.org>
parents: 2647
diff changeset
8 \code{items()} and \code{values()} methods are not supported.
c6fe80ce7c20 documented default flag, mode; changed gdbm into a pointer to dbm
Guido van Rossum <guido@python.org>
parents: 2647
diff changeset
9
c6fe80ce7c20 documented default flag, mode; changed gdbm into a pointer to dbm
Guido van Rossum <guido@python.org>
parents: 2647
diff changeset
10 See also the \code{gdbm} module, which provides a similar interface
c6fe80ce7c20 documented default flag, mode; changed gdbm into a pointer to dbm
Guido van Rossum <guido@python.org>
parents: 2647
diff changeset
11 using the GNU GDBM library.
c6fe80ce7c20 documented default flag, mode; changed gdbm into a pointer to dbm
Guido van Rossum <guido@python.org>
parents: 2647
diff changeset
12 \bimodindex{gdbm}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
13
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
14 The module defines the following constant and functions:
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
15
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
16 \renewcommand{\indexsubitem}{(in module dbm)}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
17 \begin{excdesc}{error}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
18 Raised on dbm-specific errors, such as I/O errors. \code{KeyError} is
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
19 raised for general mapping errors like specifying an incorrect key.
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
20 \end{excdesc}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
21
2814
c6fe80ce7c20 documented default flag, mode; changed gdbm into a pointer to dbm
Guido van Rossum <guido@python.org>
parents: 2647
diff changeset
22 \begin{funcdesc}{open}{filename\, \optional{flag\, \optional{mode}}}
c6fe80ce7c20 documented default flag, mode; changed gdbm into a pointer to dbm
Guido van Rossum <guido@python.org>
parents: 2647
diff changeset
23 Open a dbm database and return a dbm object. The \var{filename}
c6fe80ce7c20 documented default flag, mode; changed gdbm into a pointer to dbm
Guido van Rossum <guido@python.org>
parents: 2647
diff changeset
24 argument is the name of the database file (without the \file{.dir} or
c6fe80ce7c20 documented default flag, mode; changed gdbm into a pointer to dbm
Guido van Rossum <guido@python.org>
parents: 2647
diff changeset
25 \file{.pag} extensions).
c6fe80ce7c20 documented default flag, mode; changed gdbm into a pointer to dbm
Guido van Rossum <guido@python.org>
parents: 2647
diff changeset
26
c6fe80ce7c20 documented default flag, mode; changed gdbm into a pointer to dbm
Guido van Rossum <guido@python.org>
parents: 2647
diff changeset
27 The optional \var{flag} argument can be
c6fe80ce7c20 documented default flag, mode; changed gdbm into a pointer to dbm
Guido van Rossum <guido@python.org>
parents: 2647
diff changeset
28 \code{'r'} (to open an existing database for reading only --- default),
c6fe80ce7c20 documented default flag, mode; changed gdbm into a pointer to dbm
Guido van Rossum <guido@python.org>
parents: 2647
diff changeset
29 \code{'w'} (to open an existing database for reading and writing),
c6fe80ce7c20 documented default flag, mode; changed gdbm into a pointer to dbm
Guido van Rossum <guido@python.org>
parents: 2647
diff changeset
30 \code{'c'} (which creates the database if it doesn't exist), or
c6fe80ce7c20 documented default flag, mode; changed gdbm into a pointer to dbm
Guido van Rossum <guido@python.org>
parents: 2647
diff changeset
31 \code{'n'} (which always creates a new empty database).
c6fe80ce7c20 documented default flag, mode; changed gdbm into a pointer to dbm
Guido van Rossum <guido@python.org>
parents: 2647
diff changeset
32
c6fe80ce7c20 documented default flag, mode; changed gdbm into a pointer to dbm
Guido van Rossum <guido@python.org>
parents: 2647
diff changeset
33 The optional \var{mode} argument is the \UNIX{} mode of the file, used
c6fe80ce7c20 documented default flag, mode; changed gdbm into a pointer to dbm
Guido van Rossum <guido@python.org>
parents: 2647
diff changeset
34 only when the database has to be created. It defaults to octal
c6fe80ce7c20 documented default flag, mode; changed gdbm into a pointer to dbm
Guido van Rossum <guido@python.org>
parents: 2647
diff changeset
35 \code{0666}.
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
36 \end{funcdesc}