python/dist/src/Doc/lib libdbhash.tex, 1.5.36.1, 1.5.36.2 libbsddb.tex, 1.11, 1.11.10.1
17 Sep
2003
17 Sep
'03
12:42 a.m.
Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv1770/Doc/lib Modified Files: Tag: release23-maint libdbhash.tex libbsddb.tex Log Message: Fix documentation bugs. Add support for iterators and other mapping methods. Convert tests to unittest format and expand their coverage. Index: libdbhash.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libdbhash.tex,v retrieving revision 1.5.36.1 retrieving revision 1.5.36.2 diff -C2 -d -r1.5.36.1 -r1.5.36.2 *** libdbhash.tex 10 Sep 2003 04:45:22 -0000 1.5.36.1 --- libdbhash.tex 16 Sep 2003 21:42:13 -0000 1.5.36.2 *************** *** 52,61 **** The database objects returned by \function{open()} provide the methods ! common to all the DBM-style databases. The following methods are ! available in addition to the standard methods. \begin{methoddesc}[dbhash]{first}{} ! It's possible to loop over every key in the database using this method ! and the \method{next()} method. The traversal is ordered by the databases internal hash values, and won't be sorted by the key values. This method returns the starting key. --- 52,61 ---- The database objects returned by \function{open()} provide the methods ! common to all the DBM-style databases and mapping objects. The following ! methods are available in addition to the standard methods. \begin{methoddesc}[dbhash]{first}{} ! It's possible to loop over every key/value pair in the database using ! this method and the \method{next()} method. The traversal is ordered by the databases internal hash values, and won't be sorted by the key values. This method returns the starting key. *************** *** 63,72 **** \begin{methoddesc}[dbhash]{last}{} ! Return the last key in a database traversal. This may be used to begin a reverse-order traversal; see \method{previous()}. \end{methoddesc} \begin{methoddesc}[dbhash]{next}{} ! Returns the key next key in a database traversal. The following code prints every key in the database \code{db}, without having to create a list in memory that contains them all: --- 63,72 ---- \begin{methoddesc}[dbhash]{last}{} ! Return the last key/value pair in a database traversal. This may be used to begin a reverse-order traversal; see \method{previous()}. \end{methoddesc} \begin{methoddesc}[dbhash]{next}{} ! Returns the key next key/value pair in a database traversal. The following code prints every key in the database \code{db}, without having to create a list in memory that contains them all: *************** *** 74,78 **** \begin{verbatim} print db.first() ! for i in xrange(1, len(d)): print db.next() \end{verbatim} --- 74,78 ---- \begin{verbatim} print db.first() ! for i in xrange(1, len(db)): print db.next() \end{verbatim} *************** *** 80,84 **** \begin{methoddesc}[dbhash]{previous}{} ! Returns the previous key in a forward-traversal of the database. In conjunction with \method{last()}, this may be used to implement a reverse-order traversal. --- 80,84 ---- \begin{methoddesc}[dbhash]{previous}{} ! Returns the previous key/value pair in a forward-traversal of the database. In conjunction with \method{last()}, this may be used to implement a reverse-order traversal. Index: libbsddb.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libbsddb.tex,v retrieving revision 1.11 retrieving revision 1.11.10.1 diff -C2 -d -r1.11 -r1.11.10.1 *** libbsddb.tex 28 May 2003 16:20:03 -0000 1.11 --- libbsddb.tex 16 Sep 2003 21:42:13 -0000 1.11.10.1 *************** *** 101,106 **** \subsection{Hash, BTree and Record Objects \label{bsddb-objects}} ! Once instantiated, hash, btree and record objects support the following ! methods: \begin{methoddesc}{close}{} --- 101,108 ---- \subsection{Hash, BTree and Record Objects \label{bsddb-objects}} ! Once instantiated, hash, btree and record objects support ! the same methods as dictionaries. In addition, they support ! the methods listed below. ! \versionchanged[Added mapping methods]{2.3.1} \begin{methoddesc}{close}{} *************** *** 178,181 **** --- 180,197 ---- >>> db.previous() ('1', '1') + >>> for k, v in db.iteritems(): + ... print k, v + 0 0 + 1 1 + 2 4 + 3 9 + 4 16 + 5 25 + 6 36 + 7 49 + 8 64 + 9 81 + >>> 8 in db + True >>> db.sync() 0
7724
Age (days ago)
7724
Last active (days ago)
0 comments
1 participants
participants (1)
-
rhettingerīŧ users.sourceforge.net