Re: Python dictionary size/entry limit?

2009-02-25 Thread Martin v. Löwis
>> On a 32-bit system, the dictionary can have up to 2**31 slots, >> meaning that the maximum number of keys is slightly smaller >> (about 2**30). > > Which, in practice, means that the size is limited by the available memory. Right. Each slot takes 12 bytes, so the storage for the slots alone wo

Re: Python dictionary size/entry limit?

2009-02-25 Thread Stefan Behnel
Martin v. Löwis wrote: > intellimi...@gmail.com wrote: >> Is there a limit to the size or number of entries that a single >> dictionary can possess? > > On a 32-bit system, the dictionary can have up to 2**31 slots, > meaning that the maximum number of keys is slightly smaller > (about 2**30). W

Re: Python dictionary size/entry limit?

2009-02-22 Thread Martin v. Löwis
intellimi...@gmail.com wrote: > Is there a limit to the size or number of entries that a single > dictionary can possess? On a 32-bit system, the dictionary can have up to 2**31 slots, meaning that the maximum number of keys is slightly smaller (about 2**30). As others have pointed out, Python's

Re: Python dictionary size/entry limit?

2009-02-22 Thread Stefan Behnel
intellimi...@gmail.com wrote: > Ummm, I didn't know about the dbm databases. It seems there are many > different > modules for this kind of tasks: gdbm, berkeley db, cdb, etc. I'm > needing to implement > a constant hashtable with a large number of keys, but only a small > fraction of them > will b

Re: Python dictionary size/entry limit?

2009-02-21 Thread intelliminer
On Feb 21, 6:47 pm, Stefan Behnel wrote: > intellimi...@gmail.com wrote: > > I wrote a script to process textual data and extract phrases from > > them, storing these phrases in a dictionary. It encounters a > > MemoryError when there are about 11.18M keys in the dictionary, and > > the size is ab

Re: Python dictionary size/entry limit?

2009-02-21 Thread Sean
Stefan Behnel wrote: intellimi...@gmail.com wrote: You may be better served with one of the dbm databases that come with Python. They live on-disk but do the usual in-memory caching. They'll likely perform a lot better than your OS level swap file. Stefan the bsddb module has the feature that

Re: Python dictionary size/entry limit?

2009-02-21 Thread Stefan Behnel
intellimi...@gmail.com wrote: > I wrote a script to process textual data and extract phrases from > them, storing these phrases in a dictionary. It encounters a > MemoryError when there are about 11.18M keys in the dictionary, and > the size is about 1.5GB. > [...] > I have 1GB of pysical memory an

Re: Python dictionary size/entry limit?

2009-02-21 Thread intelliminer
On Feb 21, 6:25 pm, Tino Wildenhain wrote: > intellimi...@gmail.com wrote: > > I wrote a script to process textual data and extract phrases from > > them, storing these phrases in a dictionary. It encounters a > > MemoryError when there are about 11.18M keys in the dictionary, and > > the size is

Re: Python dictionary size/entry limit?

2009-02-21 Thread Tino Wildenhain
intellimi...@gmail.com wrote: I wrote a script to process textual data and extract phrases from them, storing these phrases in a dictionary. It encounters a MemoryError when there are about 11.18M keys in the dictionary, and the size is about 1.5GB. I tried multiple times, and the error occurs ev

Python dictionary size/entry limit?

2009-02-21 Thread intelliminer
I wrote a script to process textual data and extract phrases from them, storing these phrases in a dictionary. It encounters a MemoryError when there are about 11.18M keys in the dictionary, and the size is about 1.5GB. I tried multiple times, and the error occurs everytime at exactly the same plac