title: List comprehension inside dictionary comprehension - scope
body: <p>I am trying to create a complete graph in a Python Dictionary in 1 line.  But when creating the list comprehension for the values I can not figure out how to specify that the key_value can not appear in the list of values (in graph speak, no self loop).</p>
  
  <p>for n nodes</p>
  
  <pre><code>G = {k:[v for v in range(n)] for k in range(n) }
  </code></pre>
  
  <p>results in this (example n = 3)</p>
  
  <pre><code>{0: [0, 1, 2], 1: [0, 1, 2], 2: [0, 1, 2]}
  </code></pre>
  
  <p>but what I want is this</p>
  
  <pre><code>{0: [1, 2], 1: [0, 2], 2: [0, 1]}
  </code></pre>
  
  <p>But trying something similar to this</p>
  
  <pre><code>G = {k:[v for v in range(n) for v !=k] for k in range(n) }
  </code></pre>
  
  <p>will throw an error at the k in the list comprehension.  So k must be out of scope for the list comprehension, which makes sense.</p>
  
  <p>Can G be defined in this method?</p>