gdbm objects not iterable?

Laszlo Nagy gandalf at shopzeus.com
Wed Oct 3 16:40:14 CEST 2007


>>
>> I know that this is a very small change, but it can make gdbm objects 
>> look more like dictionaries.
>>
>> Please make comments. :-)
>>
>>     
> What you would need is a method to *create and return* a generator, and 
> it's the generator that should have the next() method. Otherwise you 
> can't have two independent iterations over the same gdbm object (and you 
> don't have a way of ensuring iteration starts at the beginning).
>   
Yes, of course, you are right. I should have returned a newly created 
generator. Still I wonder why we do not have this? Would it be a good 
idea to make gdbm objects iterable by default?

Thanks,

   Laszlo




More information about the Python-list mailing list