title: overriding __cmp__ python function
body: <p>Hi I am overriding <code>__cmp__</code> . If the second object passed is <code>None</code>, or if it is not an instance of <code>someClass</code>, then it returns <code>-1</code>.</p>
  
  <p>I don't understand what exactly is happening here. </p>
  
  <pre><code>class someClass():
      def __cmp__(self, obj):
          if obj == None:
              return -1
          if not isinstance(obj, someClass):
              return -1  
  </code></pre>
  
  <p>My test function:</p>
  
  <pre><code>def test_function(self):  
          obj1 = someClass()
          self.assertTrue(obj1 &lt; None)
          # I get true.
          self.assertTrue(obj1 &gt; None)
          # I get failure as False is returned.
  </code></pre>
  
  <p>Could anyone please explain to me:</p>
  
  <ul>
  <li>What are the return values?</li>
  <li>How is it deciding whether it will return <code>True</code> or <code>False</code> when the comparison signs are changed?</li>
  </ul>