1- \section {Standard Modules \module {anydbm} and \module {dumbdbm } }
1+ \section {Standard Module \module {anydbm} }
22\label {module-anydbm }
3- \label {module-dumbdbm }
43\stmodindex {anydbm}
5- \stmodindex {dumbdbm}
64
75\module {anydbm} is a generic interface to variants of the DBM
8- database--DBM, GDBM, or dbhash. If none of these modules is
9- installed, the slow-but-simple implementation in module \module {dumbdbm}
10- will be used. Both modules provide the same interface:
11-
12- % not the best solution, but it's what you get for documenting both
13- % at the same time.
14- \setindexsubitem {(in modules anydbm, dumbdbm)}
6+ database --- \module {dbhash}\refbimodindex {dbhash},
7+ \module {gdbm}\refbimodindex {gdbm}, or \module {dbm}\refbimodindex {dbm}.
8+ If none of these modules is installed, the slow-but-simple
9+ implementation in module \module {dumbdbm}\refstmodindex {dumbdbm} will
10+ be used.
1511
16- \begin {funcdesc }{open}{filename\optional {, flag, mode}}
12+ \begin {funcdesc }{open}{filename\optional {, flag\optional { , mode} }}
1713Open the database file \var {filename} and return a corresponding object.
1814The optional \var {flag} argument can be
1915\code {'r'} to open an existing database for reading only,
@@ -27,13 +23,41 @@ \section{Standard Modules \module{anydbm} and \module{dumbdbm}}
2723\code {0666} (and will be modified by the prevailing umask).
2824\end {funcdesc }
2925
26+ \begin {excdesc }{error}
27+ An alternate name for the \exception {error} exception defined by the
28+ underlying database implementation.
29+ \end {excdesc }
30+
3031The object returned by \function {open()} supports most of the same
3132functionality as dictionaries; keys and their corresponding values can
3233be stored, retrieved, and deleted, and the \method {has_key()} and
3334\method {keys()} methods are available. Keys and values must always be
3435strings.
3536
36- Both modules also export the exception \exception {error}, which is
37- raised for various problems. The \exception {anydbm.error} exception
38- is simply a different name for the \exception {error} exception of the
39- underlying implementation module used.
37+
38+
39+ \section {Standard Module \module {dumbdbm} }
40+ \label {module-dumbdbm }
41+ \stmodindex {dumbdbm}
42+
43+ A simple and slow database implemented entirely in Python. This
44+ should only be used when no other DBM-style database is available.
45+
46+
47+ \begin {funcdesc }{open}{filename\optional {, flag\optional {, mode}}}
48+ Open the database file \var {filename} and return a corresponding object.
49+ The optional \var {flag} argument can be
50+ \code {'r'} to open an existing database for reading only,
51+ \code {'w'} to open an existing database for reading and writing,
52+ \code {'c'} to create the database if it doesn't exist, or
53+ \code {'n'}, which will always create a new empty database. If not
54+ specified, the default value is \code {'r'}.
55+
56+ The optional \var {mode} argument is the \UNIX {} mode of the file, used
57+ only when the database has to be created. It defaults to octal
58+ \code {0666} (and will be modified by the prevailing umask).
59+ \end {funcdesc }
60+
61+ \begin {excdesc }{error}
62+ Raised for errors not reported as \exception {KeyError} errors.
63+ \end {excdesc }
0 commit comments