Sorted and reversed on huge dict ?
mike.klaas at gmail.com
Sat Nov 4 05:54:07 CET 2006
vd12005 at yahoo.fr wrote:
> thanks for your replies :)
> so i just have tried, even if i think it will not go to the end => i
> was wrong : it is around 1.400.000 entries by dict...
> but maybe if keys of dicts are not duplicated in memory it can be done
> (as all dicts will have the same keys, with different (count) values)?
Definitely a good strategy. The easiest way is to use intern(key) when
storing the values. (This will only work if you are using 8bit
strings. You'll have to maintain your own object cache if you are
I've reduced the memory requirements of very similar apps this way.
More information about the Python-list