Outdated documentation

Laszlo Zsolt Nagy gandalf at designaproduct.biz
Mon Oct 17 09:28:46 CEST 2005

    Hi All,

This is from the documentation of the dbhash module:

    Returns the key next key/value pair in a database traversal. The
    following code prints every key in the database |db|, without having
    to create a list in memory that contains them all:

print db.first()
for i in xrange(1, len(db)):
    print db.next()

Apparently, it is different for gdbm:

k = db.firstkey()
while k != None:
    print k
    k = db.nextkey(k)

I think both of them is outdated. This should be:

for key,value in db.iteritems():
    print key,value

Is this the good place to post?


More information about the Python-list mailing list