[New-bugs-announce] [issue22973] hash() function gives the same result for -1 and for -2 argument (==-2)

ardabro report at bugs.python.org
Mon Dec 1 12:18:28 CET 2014


New submission from ardabro:

built-in hash() function cannot be effectively used for integers due to 
weird behavior for -1 argument:

>>> hash(0)
0
>>> hash(-1)
-2                # !!!!!
>>> hash(-2)
-2
>>> hash(-3)
-3
>>>

----------
components: Library (Lib)
messages: 231932
nosy: ardabro
priority: normal
severity: normal
status: open
title: hash() function gives the same result for -1 and for -2 argument (==-2)
type: behavior
versions: Python 2.7, Python 3.4

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue22973>
_______________________________________


More information about the New-bugs-announce mailing list