title: How to calculate hash of a python class object
body: <p>In python3, I have a class. Like below:</p>
  
  <pre><code>class Foo:
      def __init__(self):
          self.x = 3
      def fcn(self, val):
          self.x += val
  </code></pre>
  
  <p>Then I instantiate objects of that class, like so:</p>
  
  <pre><code>new_obj = Foo()
  new_obj2 = Foo()
  </code></pre>
  
  <p>Now when I hash these objects, I get <em>different hash values</em>. I need them to return the same hash, as they are the same objects (in theory). </p>
  
  <p>Any idea how I can do this?</p>