Python WTF?

>>> for i in range (0, 10):
...     hash(i)
... 
0
1
2
3
4
5
6
7
8
9
>>> hash(123324)
123324
>>> hash(785345345436845768)
785345345436845768
>>> 

WTF?
Filed under  //   geek  

Comments (2)

Nov 19, 2009
Roman Kirillov said...
OK, it's not that bad really:

>>> hash(1)
1
>>> hash('abc')
1453079729188098211
>>> hash('bcd')
327024216812240872
>>> hash('hello')
840651671246116861
>>> hash('world')
-4197332404363456935
>>> hash(34243242344235346456756345345)
2368174836462727840
>>> hash(3424324234423534645675)
-6770163286441954716

Nov 19, 2009
Holger Dürer said...
So what is the WTF here? You were hoping for the hash value to be better mixed for similar numbers?

Leave a comment...

 
To leave a comment on this posterous, please login by clicking one of the following.
Posterous-login     Connect     twitter

About

A mad-eye programmer. No, really!