title: How to sort with lambda in Python
body: <p>I am trying to sort some values by attribute, like so:</p>
  <pre><code>a = sorted(a, lambda x: x.modified, reverse=True)
  </code></pre>
  <p>I get this error message:</p>
  <pre><code>&lt;lambda&gt;() takes exactly 1 argument (2 given)
  </code></pre>
  <p>Why? How do I fix it?</p>
  <hr />
  <p><sub>This question was originally written for Python 2.x. In 3.x, the error message will be different: <code>TypeError: sorted expected 1 argument, got 2</code>.</sub></p>