Multiple Levels of Sorting without module
<p><a href="https://wiki.python.org/moin/HowTo/Sorting" rel="nofollow">This article</a> states that you can use multiple levels of sorting with the <code>operator</code> module.</p>

<blockquote>
  <p>The operator module functions allow multiple levels of sorting. For example, to sort by grade then by age: </p>
</blockquote>

<pre><code>&gt;&gt;&gt;sorted(student_objects, key=attrgetter('grade', 'age'))
[('john', 'A', 15), ('dave', 'B', 10), ('jane', 'B', 12)]
</code></pre>

<p>This should be possible to do the standard way without needing a module:</p>

<pre><code>sorted(student_objects, key=lambda student: student.age #somehow add another
</code></pre>

<p>I can't figure out the standard way to do this though, is it possible?</p>

<p>Do what the function in <code>operator</code> does and return a tuple:</p>

<pre><code>key=lambda student: (student.grade, student.age)
</code></pre>

python sorting