On Jun 27, 12:11 pm, Robin Becker <[EMAIL PROTECTED]> 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

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to