Advertisement
Guest User

Untitled

a guest
Feb 4th, 2011
1,390
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.42 KB | None | 0 0
  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
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement