title: Unable to implement __lt__ (less than) method to sort a list of class objects
body: <p>I am trying to use _lt__ method to compare class objects and sort accordingly.But haven't been able to do so far</p>
  
  <pre><code>class Test:
  
      def __init__(self,x):
          self.x = x
  
      def __lt__(self,other):
          return self.x &lt; other.x
  
  t1 = Test(10)
  t2 = Test(12)
  lis = [t1,t2]
  lis.sort()
  print(lis)
  </code></pre>
  
  <p>I am getting output as</p>
  
  <pre><code>[&lt;__main__.Test object at 0x7fd4c592fb70&gt;, &lt;__main__.Test object at 0x7fd4c592fb38&gt;]
  </code></pre>
  
  <p>I thought maybe I need to give a string representation to the object.So I did</p>
  
  <pre><code>def __str__(self):
      return "{}".format(self.x)
  </code></pre>
  
  <p>Still I am getting the same output</p>
  
  <pre><code>[&lt;__main__.Test object at 0x7f212594bac8&gt;, &lt;__main__.Test object at 0x7f212594bc50&gt;]
  </code></pre>
  
  <p>What am I doing wrong?</p>