Author akitada
Recipients akitada, loewis
Date 2009-04-12.09:47:36
SpamBayes Score 2.22668e-05
Marked as misclassified No
Message-id <1239529659.3.0.960618338891.issue5736@psf.upfronthosting.co.za>
In-reply-to
Content
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
History
Date User Action Args
2009-04-12 09:47:39akitadasetrecipients: + akitada, loewis
2009-04-12 09:47:39akitadasetmessageid: <1239529659.3.0.960618338891.issue5736@psf.upfronthosting.co.za>
2009-04-12 09:47:38akitadalinkissue5736 messages
2009-04-12 09:47:38akitadacreate