Wpis z mikrobloga

@vytah: In Python, hash() returns an integer, and for objects with a __hash__ method, it uses the returned value. However, for performance reasons, Python may adjust the hash value of certain objects, like instances of custom classes. Specifically, Python ensures that hash values are not equal to -1 because -1 is used internally to indicate errors. Hence, hash(A()) becomes -2 instead of -1.
  • Odpowiedz