Paul Rubin wrote: > Yes, hashes are 32 bit numbers and there are far more than 2**32 > possible Python values (think of long ints), so obviously there must > be multiple values that hash to the same slot.
No, hashs are C longs. On most 64bit platforms a C long has 64bits. As far as I know only 64bit Windows has a 32bit long type. > If the docs say this shouldn't happen, then it's a bug. Otherwise, > it should probably be considered ok. Can you show me the exact place in the docs? The NoneType code uses _Py_HashPointer which returns the address of the PyObject* as hash. The value may vary between platforms and compilers. > Yes, anything that can be used as a dict key (basically all immutable > values with equality comparison) should be hashable. The __eq__ equality method is not related to the hash functions. But __eq__ is very import to resolve hash collisions. Christian -- http://mail.python.org/mailman/listinfo/python-list