Akira Kitada <akit...@gmail.com> added the comment: Here's another patch which addsd iter to dbm and gdbm.
Note that dbm and gdbm C API is a little different. gdbm_nextkey requires key for its argument, dbm_nextkey don't. So I had to use for gdbm an static variable that points to the current position. Now iterator in gdbm and dbm works differently. >>> import dbm >>> d = dbm.open('foo', 'n') >>> d['k1'] = 'v1';d['k2'] = 'v2'; >>> for i in d: print i; break ... k1 >>> for i in d: print i ... k2 >>> for i in d: print i ... >>> import gdbm >>> gd = gdbm.open('foo.gdbm', 'n') >>> gd['k1'] = 'v1';gd['k2'] = 'v2'; >>> for i in gd: print i; break ... k2 >>> for i in gd: print i for i in gd: print i ... k1 >>> for i in gd: print i ... k2 k1 ---------- Added file: http://bugs.python.org/file13676/issue5736.diff _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue5736> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com