Newbie: Large dictionaries

Steve Purcell stephen_purcell at yahoo.com
Fri Feb 23 05:36:54 EST 2001


Mikkel Rasmussen wrote:
> Why can't there be more than about 65.000 entries in a dictionary, or more
> importantly: how can I make a large dictionary with room for at least
> 500.000
> elements?

It's probably a memory issue: how big are the keys and/or values?

On my machine, I can easily get a million entries into a dictionary:-

>>> dict = {}
>>> try:
...   for i in xrange(1000000):
...     dict[i] = None
... except:
...   print "stopped at", i
...   raise
... 
>>> 

-Steve

-- 
Steve Purcell, Pythangelist
Get testing at http://pyunit.sourceforge.net/
Get servlets at http://pyserv.sourceforge.net/
"Even snakes are afraid of snakes." -- Steven Wright




More information about the Python-list mailing list