Why does a Ruby hash have an integer n up to 2 * n + 1 ?
>> [0,1,2,3].each {|x| puts x.hash} 1 3 5 7
I see that you do not always need complex hashes, especially for simple objects. But why is the "double and add 1" rule unlike what Python does, which is an integer number of hashes for itself?
>>> map(hash,[0,1,2,3]) [0, 1, 2, 3]
Is there a reason?
source share