How to use a 5 or 6 bit integer in Python?

Rainer Deyke rainerd at eldwood.com
Fri Dec 19 01:27:59 EST 2003


Glen Wheeler wrote:
>   I have one constantly changing dict with many millions of keys
> (tuples of ints) which in turn associates itself with a tuple of ints
> and two more dicts.

That makes things a bit harder.  I expect that the big dict itself requires
at least sixteen bytes per entry.  How big are your tuples?  How big are the
dicts in the data tuples?  What data do they contain?  Are any of the tuples
or dicts shared?

Encoding the key tuples as strings is easy (''.join([chr(x) for x in
the_tuple]).  Encoding the ints in the data tuples is just as easy.  I'm not
sure if those are enough to solve your problem.


-- 
Rainer Deyke - rainerd at eldwood.com - http://eldwood.com






More information about the Python-list mailing list