title: How to verify if class implements a rich comparison method?
body: <p>With the old style classes simply using <code>hasattr</code> works:</p>
  
  <pre><code>&gt;&gt;&gt; class old:
  ...     pass
  ...
  &gt;&gt;&gt; hasattr(old, '__eq__')
  False
  </code></pre>
  
  <p>Using the new style classes every class has the attribute <code>__eq__</code>:</p>
  
  <pre><code>&gt;&gt;&gt; class nsc(object):
  ...     pass
  ...
  &gt;&gt;&gt; hasattr(nsc, '__eq__')
  True
  </code></pre>
  
  <p>This is the expected behaviour as <code>hasattr(object, '__eq__')</code> also returns <code>True</code>. This is true for every rich comparison method.</p>
  
  <p>How to verify if class implements a rich comparison method if I can't use <code>hasattr</code>? One thing that comes to mind is to call the method and see if it raises a <code>NotImplemented</code> exception. But calling those methods may have unexpected damages.</p>