title: Sort by multiple keys using different orderings
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/11206884/how-to-write-python-sort-key-functions-for-descending-values">How to write Python sort key functions for descending values</a>  </p>
  </blockquote>
  
  
  
  <p>In Python 3, it's pretty easy to sort a list of objects lexicographically using multiple keys.  For example:</p>
  
  <p><code>items.sort(key = lambda obj: obj.firstname, obj.lastname)</code></p>
  
  <p>The <code>reverse</code> argument lets you specify whether you want ascending or descending order.  But what do you do in the case where you want to sort by multiple keys, but you want to sort using descending order for the first key, and ascending order for the second?</p>
  
  <p>For example, suppose we have an object with two attributes, <code>points</code> and <code>name</code>, where <code>points</code> is an <code>int</code> and <code>name</code> is a <code>str</code>.  We want to sort a list of these objects by <code>points</code> in <em>descending</em> order (so that the object with the greatest number of points comes first), but for objects with an equal number of <code>points</code>, we want to sort these by <code>name</code> in alphabetical (<em>ascending</em>) order.</p>
  
  <p>How can this be achieved?</p>