title: I can't wrap my head aroung this python function for a sorted(key)
body: <p>This returns a list of tuples sorted by the tuple's last character but I'm not sure why or how it works:  </p>
  
  <pre><code>def sort_last(tuples):
    def last(a):
      return a[-1]
  return sorted(tuples, key=last)
  </code></pre>
  
  <p>I don't understand why the two functions don't require shared arguments for this code to produce the desired result.</p>
  
  <p>Can you explain how and or why this works?</p>