title: Custom __lt__ method for comparisons
body: <p>I want to be able to sort a list of classes by one attribute, which happens to be another class Date. I have done some research and want to use the <code>sorted(list, key=lambda x:date)</code> method of sorting, but seeing as date is a class in itself how can I write an <code>__lt__</code> function in date to allow me to sort chronologically?</p>
  
  <p>I want something along the lines of:</p>
  
  <pre><code>if self.year!= other.year:
      return self.year &lt; other.year
  elif self.month != pther.month
  ...
  </code></pre>
  
  <p>and so on.</p>
  
  <p>Here is my Date class:</p>
  
  <pre><code>class Date:
      def __init__(self, month, day, year, minute, hour, string):
          self.month = month
          self.day = day
          self.year = year
          self.minute = minute
          self.hour = hour
          self.string = string
  </code></pre>
  
  <p>I should probably mention that this is the first time I have ever used Python, so I'm not very good at this.</p>
  
  <p>Thanks in advance!</p>