16bit hash

Robin Becker robin at reportlab.com
Wed Jun 27 13:11:03 EDT 2007


Josiah Carlson wrote:
> Robin Becker wrote:
>> Is the any way to get an efficient 16bit hash in python?
> 
> hash(obj)&65535
> 
>   - Josiah
yes I thought of that, but cannot figure out if the internal hash really 
distributes the bits evenly. Particularly since it seems to treat integers etc 
as special cases

 >>> hash(1)
1
 >>> hash(2)
2
 >>> hash('1234')
1723328704
 >>>
-- 
Robin Becker




More information about the Python-list mailing list