[Python-bugs-list] [ python-Bugs-802302 ] Invalid documentation for
dbhash.
SourceForge.net
noreply at sourceforge.net
Mon Sep 8 01:35:41 EDT 2003
Bugs item #802302, was opened at 2003-09-08 03:35
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=802302&group_id=5470
Category: Documentation
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Jeremy Fincher (jemfinch)
Assigned to: Nobody/Anonymous (nobody)
Summary: Invalid documentation for dbhash.
Initial Comment:
The documentation for dbhash is incorrect. Using its *exact*
example:
functor% python
Python 2.3+ (#2, Aug 10 2003, 11:33:47)
[GCC 3.3.1 (Debian)] on linux2
Type "help", "copyright", "credits" or "license" for more
information.
>>> import dbhash
>>> db = dbhash.open('awaken.dbm', 'r')
>>> k = db.first()
>>> while k != None:
... print k
... k = db.next(k)
...
('U465', '(lp0\nS"Ulerin\'s"\np1\na.')
Traceback (most recent call last):
File "<stdin>", line 3, in ?
TypeError: next() takes exactly 1 argument (2 given)
Whereas the documentation says:
next(key)
Returns the key that follows key in the traversal. The following
code prints every key in the database db, without having to create
a list in memory that contains them all:
k = db.first()
while k != None:
print k
k = db.next(k)
Also interesting is that this is apparently supposed to iterate
through the keys, but it appears to be iterating through the items
in general: notice the one key printed was ('U465', '(lp0\nS"Ulerin
\'s"\np1\na.').
Incidentally, it works with no argument to .next, but errors at
some point:
>>> import dbhash
>>> db = dbhash.open('awaken.dbm', 'r')
>>> k = db.first()
>>> fd = file('/dev/null', 'w')
>>> while k != None:
... print >>fd, k
... k = db.next()
...
Traceback (most recent call last):
File "<stdin>", line 3, in ?
File "/usr/lib/python2.3/bsddb/__init__.py", line 122, in next
rv = self.dbc.next()
_bsddb.DBNotFoundError: (-30991, 'DB_NOTFOUND: No
matching key/data pair found')
This is before finishing the iteration through the database. But
this is probably a different bug report; I want to make sure I'm not
misunderstanding something first.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=802302&group_id=5470
More information about the Python-bugs-list
mailing list