Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!

hash() on objects

By: michaelmior on Apr 10th, 2012  |  syntax: Python  |  size: 0.14 KB  |  views: 32  |  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 Foo(object):
  2.     def __init__(self, x):
  3.         self.x = x
  4.  
  5. # These two values are the same
  6. print(hash(Foo(3)))
  7. print(hash(Foo(4)))