iterating through humongously large key lists!!

Alex Martelli aleaxit at yahoo.com
Wed Apr 25 10:04:58 EDT 2001


"Mark blobby Robinson" <m.1.robinson at herts.ac.uk> wrote in message
news:3AE69EF6.46C74A31 at herts.ac.uk...
> Is it is possible to interate through the keys of a dictionary object
> without loading the entire key list into memory? I am working with a

Not right now, although .popitem does something similar (but
destructively on the directory you're iterating on).

> situation where I need to interate through a dictionary containly
> routinely millions and potentually many millions of keys. Not only is it
> painfully slow to generate the list, but it eats into my memory
> significantly too. Please tell me there is a better way.

I think the iterators in 2.2 will satisfy your request.


Alex






More information about the Python-list mailing list