title: Testing for reference equality in Python
body: <p>Say I have a class in Python that has an eq method defined for comparing attributes for equality:</p>
  
  <pre><code>class Foo(object):
      # init code...
  
      def __eq__(self, other):
          # usual eq code here....
  </code></pre>
  
  <p>How can I then compare two instances of Foo for reference equality (that is test if they are the same instance)?  If I do:</p>
  
  <pre><code>f1 = Foo()
  f2 = Foo()
  print f1 == f2
  </code></pre>
  
  <p>I get True even though they are different objects.</p>