[sugar] python hash function limited to specific table size?

Dan Williams dcbw
Thu Mar 15 08:05:46 EDT 2007


Does anyone know if python has a hash function that one can pass a size
to, to limit the returned hash value to a specific range?

I've got an array with ~520 color pairs, and I'd like to take an
arbitrary string of bytes, hash that, and use the hash as an index into
that table to pull out the same color pair for the same bytes every

As I understand it, Python's built-in hash function for the base types
is locked and optimizied to a table size of 2^32 or something like that.


More information about the Sugar-devel mailing list