title: Using a function with changing parameters as a key in sort
body: <p>I am trying to sort a list of points in the x-y plane according to their polar angle with a point selected from the list that has the minimum y value.</p>
  
  <p>I used </p>
  
  <pre><code>min(listPts, key=lambda t: (t[1], -t[0]))
  </code></pre>
  
  <p>to find the minimum y value in listPts</p>
  
  <p>I have a function theta to find the angles between two points</p>
  
  <pre><code>def theta(pointA, pointB):
  
      dx = pointB[0] - pointA[0]
      dy = pointB[1] - pointA[1]
      if abs(dx) &lt; 1.e-6 and abs(dy) &lt; 1.e-6:
          t = 0
      else:
           t = dy / (abs(dx) + abs(dy))
      if dx &lt; 0:
          t = 2 - t
      elif dy &lt; 0:
          t = 4 + t
      return t * 90
  </code></pre>
  
  <p>I was wondering if its possible to somehow use this function as a key in the .sort() method as each point being check will have a different pointB for theta?</p>
  
  <p>cheers</p>