title: Python lambda expression not doing what is expected
body: <p>I have a list. Each entry is another list with entries, one being the names of the nodes, and the other entry being the corresponding node weights.</p>
  
  <pre><code>l = [ [['A', 'C', 'B', 'D'], [2, 4, 3, 2]], [['E', 'F'], [3, 66]] ]
  </code></pre>
  
  <p>I want to sort the list in decreasing order based on the sum of the weights for each node. So for this example, <code>['E', 'F']</code> entry will come first because <code>3 + 66 &gt; 2 + 4 + 3 + 2</code></p>
  
  <p>I wrote a lambda expression like so:</p>
  
  <p><code>l.sort(key=lambda x: x if not x[1] else sum(x[1]))</code></p>
  
  <p>But it is not giving me the right answer. For every <code>x</code> in <code>l</code> you have two entries <code>0</code> and <code>1</code>, <code>1</code> being the list of weights, so I am giving that to <code>sum</code> function so sort it but it is giving me the wrong answer.</p>