Why is it that *dbm modules don't provide an iterator? (Language design question)

Joshua Kugler joshua at joshuakugler.com
Thu Apr 9 16:42:51 EDT 2009


Akira Kitada wrote:

> The loop has to be:
> """
>>>> k = d.firstkey()
>>>> while k != None:
> ...    print k
> ...    k = d.nextkey(k)
> key2
> key1
> """

Why not

for key in d.keys():
    print key

That worked for me.

j




More information about the Python-list mailing list