This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Feb 4th, 2011  |  syntax: Python  |  size: 0.42 KB  |  views: 319  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. >>> class A(object):
  2. ...     def __hash__(self): return 10**100
  3. ...
  4. >>> class B(object):
  5. ...     def __hash__(self): return hash(10**100)
  6. ...
  7. >>> class C(object):
  8. ...     def __hash__(self): return 10
  9. ...
  10. >>> a  = A()
  11. >>> b = B()
  12. >>> c = C()
  13. >>> hash(a) == hash(b)
  14. True
  15. >>> hash(hash(a) ^ hash(c)) == hash(hash(b) ^ hash(c))
  16. True
  17. >>> hash(a.__hash__() ^ c.__hash__()) == hash(b.__hash__() ^ c.__hash__())
  18. False
clone this paste RAW Paste Data