title: How to sort a list and handle None values properly?
body: <p>I am trying to sort a list of objects using the date attribute with </p>
  
  <pre><code>list_of_objects.sort(key=lambda x: x.date, reverse=True)
  </code></pre>
  
  <p>but some dates are just None, which means that I get the error</p>
  
  <pre><code>TypeError: can't compare datetime.datetime to NoneType
  </code></pre>
  
  <p>is there a way to account for this? e.g. Have objects with <code>date == None</code> at the top or bottom of the sorted list—or do I need to do this manually?</p>