Hash() values #97

Open
pyjsorg opened this Issue Apr 27, 2012 · 0 comments

Projects

None yet

1 participant

@pyjsorg
Contributor
pyjsorg commented Apr 27, 2012

Python requires that hash() values should be

  1. of numeric type
  2. same for values coercible to numeric types, including
    >>> hash(True) == hash(1)
    True
    >>> hash(False) == hash(0)
    True

This affects set, dict and possibly other code, which relies on hash() values.
For example, in CPython:

>>> set([True, False, 1, 0])
set([False, True])

while in pyjs its set([True, False, 1, 0])

Original issue: http://code.google.com/p/pyjamas/issues/detail?id=626 (July 01, 2011 08:16:55)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment