annotate Doc/libanydbm.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 952851d9cce2
children 53a07ada499a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5463
952851d9cce2 Added docs for dumbdbm (AMK), and misc small fixes.
Guido van Rossum <guido@python.org>
parents: 5261
diff changeset
1 \section{Standard Modules \sectcode{anydbm} and \sectcode{dumbdbm}}
5261
72986b716824 New stuff by AMK.
Guido van Rossum <guido@python.org>
parents:
diff changeset
2 \stmodindex{anydbm}
72986b716824 New stuff by AMK.
Guido van Rossum <guido@python.org>
parents:
diff changeset
3 \stmodindex{dumbdbm}
72986b716824 New stuff by AMK.
Guido van Rossum <guido@python.org>
parents:
diff changeset
4
72986b716824 New stuff by AMK.
Guido van Rossum <guido@python.org>
parents:
diff changeset
5 \code{anydbm} is a generic interface to variants of the DBM
72986b716824 New stuff by AMK.
Guido van Rossum <guido@python.org>
parents:
diff changeset
6 database--DBM, GDBM, or dbhash. If none of these modules is
5463
952851d9cce2 Added docs for dumbdbm (AMK), and misc small fixes.
Guido van Rossum <guido@python.org>
parents: 5261
diff changeset
7 installed, the slow-but-simple implementation in module \code{dumbdbm}
952851d9cce2 Added docs for dumbdbm (AMK), and misc small fixes.
Guido van Rossum <guido@python.org>
parents: 5261
diff changeset
8 will be used. Both modules provide the same interface:
5261
72986b716824 New stuff by AMK.
Guido van Rossum <guido@python.org>
parents:
diff changeset
9
72986b716824 New stuff by AMK.
Guido van Rossum <guido@python.org>
parents:
diff changeset
10 \begin{funcdesc}{open}{filename\optional{\, flag\, mode}}
72986b716824 New stuff by AMK.
Guido van Rossum <guido@python.org>
parents:
diff changeset
11 Open the database file \var{filename} and return a corresponding object.
72986b716824 New stuff by AMK.
Guido van Rossum <guido@python.org>
parents:
diff changeset
12 The optional \var{flag} argument can be
72986b716824 New stuff by AMK.
Guido van Rossum <guido@python.org>
parents:
diff changeset
13 \code{'r'} to open an existing database for reading only,
72986b716824 New stuff by AMK.
Guido van Rossum <guido@python.org>
parents:
diff changeset
14 \code{'w'} to open an existing database for reading and writing,
72986b716824 New stuff by AMK.
Guido van Rossum <guido@python.org>
parents:
diff changeset
15 \code{'c'} to create the database if it doesn't exist, or
72986b716824 New stuff by AMK.
Guido van Rossum <guido@python.org>
parents:
diff changeset
16 \code{'n'}, which will always create a new empty database. If not
72986b716824 New stuff by AMK.
Guido van Rossum <guido@python.org>
parents:
diff changeset
17 specified, the default value is \code{'r'}.
72986b716824 New stuff by AMK.
Guido van Rossum <guido@python.org>
parents:
diff changeset
18
72986b716824 New stuff by AMK.
Guido van Rossum <guido@python.org>
parents:
diff changeset
19 The optional \var{mode} argument is the \UNIX{} mode of the file, used
72986b716824 New stuff by AMK.
Guido van Rossum <guido@python.org>
parents:
diff changeset
20 only when the database has to be created. It defaults to octal
5463
952851d9cce2 Added docs for dumbdbm (AMK), and misc small fixes.
Guido van Rossum <guido@python.org>
parents: 5261
diff changeset
21 \code{0666} (and will be modified by the prevailing umask).
5261
72986b716824 New stuff by AMK.
Guido van Rossum <guido@python.org>
parents:
diff changeset
22 \end{funcdesc}
72986b716824 New stuff by AMK.
Guido van Rossum <guido@python.org>
parents:
diff changeset
23
5463
952851d9cce2 Added docs for dumbdbm (AMK), and misc small fixes.
Guido van Rossum <guido@python.org>
parents: 5261
diff changeset
24 The object returned by \code{open()} supports most of the same
5261
72986b716824 New stuff by AMK.
Guido van Rossum <guido@python.org>
parents:
diff changeset
25 functionality as dictionaries; keys and their corresponding values can
72986b716824 New stuff by AMK.
Guido van Rossum <guido@python.org>
parents:
diff changeset
26 be stored, retrieved, and deleted, and the \code{has_key()} and
5463
952851d9cce2 Added docs for dumbdbm (AMK), and misc small fixes.
Guido van Rossum <guido@python.org>
parents: 5261
diff changeset
27 \code{keys()} methods are available. Keys and values must always be
952851d9cce2 Added docs for dumbdbm (AMK), and misc small fixes.
Guido van Rossum <guido@python.org>
parents: 5261
diff changeset
28 strings.
5261
72986b716824 New stuff by AMK.
Guido van Rossum <guido@python.org>
parents:
diff changeset
29
5463
952851d9cce2 Added docs for dumbdbm (AMK), and misc small fixes.
Guido van Rossum <guido@python.org>
parents: 5261
diff changeset
30 Both modules also export the exception \code{error}, which is raised
952851d9cce2 Added docs for dumbdbm (AMK), and misc small fixes.
Guido van Rossum <guido@python.org>
parents: 5261
diff changeset
31 for various problems. The \code{anydbm.error} exception is simply a
952851d9cce2 Added docs for dumbdbm (AMK), and misc small fixes.
Guido van Rossum <guido@python.org>
parents: 5261
diff changeset
32 different name for the \code{error} exception of the underlying
952851d9cce2 Added docs for dumbdbm (AMK), and misc small fixes.
Guido van Rossum <guido@python.org>
parents: 5261
diff changeset
33 implementation module used.