mirror of https://github.com/python/cpython.git
Added a few items to the "See also" sections at Guido's prompting. Made
more references to other modules in the text hyperlinks for the HTML and PDF versions.
This commit is contained in:
parent
766e0cbde1
commit
01553706bf
|
@ -7,17 +7,17 @@
|
|||
|
||||
\module{anydbm} is a generic interface to variants of the DBM
|
||||
database --- \module{dbhash}\refbimodindex{dbhash},
|
||||
\module{gdbm}\refbimodindex{gdbm}, or \module{dbm}\refbimodindex{dbm}.
|
||||
If none of these modules is installed, the slow-but-simple
|
||||
implementation in module \module{dumbdbm}\refstmodindex{dumbdbm} will
|
||||
be used.
|
||||
\refmodule{gdbm}\refbimodindex{gdbm}, or
|
||||
\refmodule{dbm}\refbimodindex{dbm}. If none of these modules is
|
||||
installed, the slow-but-simple implementation in module
|
||||
\refmodule{dumbdbm}\refstmodindex{dumbdbm} will be used.
|
||||
|
||||
\begin{funcdesc}{open}{filename\optional{, flag\optional{, mode}}}
|
||||
Open the database file \var{filename} and return a corresponding object.
|
||||
|
||||
If the database file already exists, the \module{whichdb} module is
|
||||
If the database file already exists, the \refmodule{whichdb} module is
|
||||
used to determine its type and the appropriate module is used; if it
|
||||
doesn't exist, the first module listed above that can be imported is
|
||||
does not exist, the first module listed above that can be imported is
|
||||
used.
|
||||
|
||||
The optional \var{flag} argument can be
|
||||
|
@ -46,6 +46,18 @@ be stored, retrieved, and deleted, and the \method{has_key()} and
|
|||
strings.
|
||||
|
||||
|
||||
\begin{seealso}
|
||||
\seemodule{anydbm}{Generic interface to \code{dbm}-style databases.}
|
||||
% Should include entry for dbhash, but that isn't documented.
|
||||
\seemodule{dbm}{Standard \UNIX{} database interface.}
|
||||
\seemodule{dumbdbm}{Portable implementation of the \code{dbm} interface.}
|
||||
\seemodule{gdbm}{GNU database interface, based on the \code{dbm} interface.}
|
||||
\seemodule{shelve}{General object persistence built on top of
|
||||
the Python \code{dbm} interface.}
|
||||
\seemodule{whichdb}{Utility module used to determine the type of an
|
||||
existing database.}
|
||||
\end{seealso}
|
||||
|
||||
|
||||
\section{\module{dumbdbm} ---
|
||||
Portable DBM implementation}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
\section{\module{shelve} ---
|
||||
Python object persistency.}
|
||||
Python object persistency}
|
||||
\declaremodule{standard}{shelve}
|
||||
|
||||
\modulesynopsis{Python object persistency.}
|
||||
|
@ -8,8 +8,8 @@
|
|||
A ``shelf'' is a persistent, dictionary-like object. The difference
|
||||
with ``dbm'' databases is that the values (not the keys!) in a shelf
|
||||
can be essentially arbitrary Python objects --- anything that the
|
||||
\code{pickle} module can handle. This includes most class instances,
|
||||
recursive data types, and objects containing lots of shared
|
||||
\refmodule{pickle} module can handle. This includes most class
|
||||
instances, recursive data types, and objects containing lots of shared
|
||||
sub-objects. The keys are ordinary strings.
|
||||
\refstmodindex{pickle}
|
||||
|
||||
|
@ -32,20 +32,20 @@ list = d.keys() # a list of all existing keys (slow!)
|
|||
|
||||
d.close() # close it
|
||||
\end{verbatim}
|
||||
%
|
||||
|
||||
Restrictions:
|
||||
|
||||
\begin{itemize}
|
||||
|
||||
\item
|
||||
The choice of which database package will be used (e.g. \code{dbm} or
|
||||
\code{gdbm})
|
||||
depends on which interface is available. Therefore it isn't safe to
|
||||
open the database directly using \code{dbm}. The database is also
|
||||
(unfortunately) subject to the limitations of \code{dbm}, if it is used ---
|
||||
this means that (the pickled representation of) the objects stored in
|
||||
the database should be fairly small, and in rare cases key collisions
|
||||
may cause the database to refuse updates.
|
||||
The choice of which database package will be used
|
||||
(e.g. \refmodule{dbm} or \refmodule{gdbm}) depends on which interface
|
||||
is available. Therefore it is not safe to open the database directly
|
||||
using \refmodule{dbm}. The database is also (unfortunately) subject
|
||||
to the limitations of \refmodule{dbm}, if it is used --- this means
|
||||
that (the pickled representation of) the objects stored in the
|
||||
database should be fairly small, and in rare cases key collisions may
|
||||
cause the database to refuse updates.
|
||||
\refbimodindex{dbm}
|
||||
\refbimodindex{gdbm}
|
||||
|
||||
|
@ -54,7 +54,7 @@ Dependent on the implementation, closing a persistent dictionary may
|
|||
or may not be necessary to flush changes to disk.
|
||||
|
||||
\item
|
||||
The \code{shelve} module does not support \emph{concurrent} read/write
|
||||
The \module{shelve} module does not support \emph{concurrent} read/write
|
||||
access to shelved objects. (Multiple simultaneous read accesses are
|
||||
safe.) When a program has a shelf open for writing, no other program
|
||||
should have it open for reading or writing. \UNIX{} file locking can
|
||||
|
@ -65,6 +65,11 @@ requires knowledge about the database implementation used.
|
|||
|
||||
|
||||
\begin{seealso}
|
||||
\seemodule{anydbm}{Generic interface to \code{dbm}-style databases.}
|
||||
% Should include entry for dbhash, but that isn't documented.
|
||||
\seemodule{dbm}{Standard \UNIX{} database interface.}
|
||||
\seemodule{dumbdbm}{Portable implementation of the \code{dbm} interface.}
|
||||
\seemodule{gdbm}{GNU database interface, based on the \code{dbm} interface.}
|
||||
\seemodule{pickle}{Object serialization used by \module{shelve}.}
|
||||
\seemodule{cPickle}{High-performance version of \module{pickle}.}
|
||||
\end{seealso}
|
||||
|
|
Loading…
Reference in New Issue