iterating through humongously large key lists!!

Alex Martelli aleaxit at yahoo.com
Thu Apr 26 08:31:36 EDT 2001


"Tim Peters" <tim.one at home.com> wrote in message
news:mailman.988247860.15811.python-list at python.org...
    [snip]
> > newdic = {}
> > while len(oldict):
> >     key, value = oldict.popitem()
    [snip]
> list of keys before, *this* one is gonna kill him:  the memory consumed by
> oldict does not decrease during this loop, so in the end you have two
dicts

*Ooops*!  Thanks for clarifying this -- I had failed to notice this
little "accident of the implementation":-(.  OK, this is not a viable
way to iterate on a 'humongously large' dictionary, then.


Alex






More information about the Python-list mailing list