16bit hash
Dan Bishop
danb_83 at yahoo.com
Wed Jun 27 21:42:23 EDT 2007
On Jun 27, 12:11 pm, Robin Becker <r... at reportlab.com> wrote:
> 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
> >>>
And then hash(-1) is a SPECIAL special case.
>>> hash(-1)
-2
More information about the Python-list
mailing list