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?

Posted in: Uncategorized

Tags:



This website uses IntenseDebate comments, but they are not currently loaded because either your browser doesn't support JavaScript, or they didn't load fast enough.

2 Comments

rssComments RSS transmitTrackBack Identifier URI


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

Comment by Roman Kirillov on November 19, 2009 9:03 am


So what is the WTF here? You were hoping for the hash value to be better mixed for similar numbers?

Comment by Holger Dürer on November 19, 2009 9:39 am

addLeave a comment