[docs] Demo code for "dbm" is wrong

Sébastien Frigon sfrigon at hotmail.com
Thu Dec 2 02:42:26 CET 2010


On this page (about module dbm in Python 3.1):
http://docs.python.org/py3k/library/dbm.html

In this code sample:
for k, v in db.iteritems():

iteritems is no longer supported in Python 3.1.  This is documented here: 
http://docs.python.org/py3k/whatsnew/3.0.html

"Also, the dict.iterkeys(), dict.iteritems() and
dict.itervalues() methods are no longer supported."

I suggest to change the following:

Old: 
for k, v in db.iteritems():

New:
for k, v in db.items():

I'm pretty new to Python so you should double check, but I have tested this myself on version 3.1.3.

Regards,

Sébastien






 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/docs/attachments/20101202/f62695c5/attachment.html>


More information about the docs mailing list