title: Python: Can you make this __eq__ easy to understand?
body: <p>I have another question for you.</p>
  
  <p>I have a python class with a list 'metainfo'. This list contains variable names that my class <em>might</em> contain. I wrote a <code>__eq__</code> method that returns True if the both <code>self</code> and <code>other</code> have the same variables from <code>metainfo</code> and those variables have the same value.</p>
  
  <p>Here is my implementation:</p>
  
  <pre><code> def __eq__(self, other):
      for attr in self.metainfo:
        try:
          ours = getattr(self, attr) 
          try:
            theirs = getattr(other, attr)
            if ours != theirs:
              return False
          except AttributeError:
            return False
        except AttributeError:
          try:
            theirs = getattr(other, attr)
            return False
          except AttributeError:
            pass
      return True
  </code></pre>
  
  <p>Does anyone have any suggestions as to how I can make this code easier on the eye? Be as ruthless as you please.</p>