title: Compare dictionary values against all other values in the same dictionary
body: <p>I have a dictionary of the format <code>D = {a:[x1,y1], b[x2,y2],.....}</code></p>
  
  <p>I have written a function to compare <code>[x1,y1]</code> with <code>[x2,y2]</code> such that:</p>
  
  <pre><code> CompareVal([x1, y1], [x2, y2]):
      if (x2 &gt; x1) and (y2 &lt; y1):
          return 1
      else:
          return 0
  </code></pre>
  
  <p>I need to iterate through the entire dictionary comparing the values of every key against all other keys, saving the total number of times the <code>return 1</code> is triggered. The end result is a list of lists <code>((a,n),(b,m)...)</code>, so that each key has the number of times the <code>return 1</code> was triggered.
  It is important that <code>a</code> is compared to <code>b</code>, AND that <code>b</code> is compared to <code>a</code>.</p>
  
  <p>What would be the best way to go about this?</p>