title: python: nested unwrapping in list-comprehension
body: <p>I am trying to achieve this in list comprehension</p>
  
  <pre><code>for y in range(depth):  # this one works
      mylist+=[x for x in s[y]]
  </code></pre>
  
  <p>This needs help:</p>
  
  <pre><code># s= [set() for _ in range(depth)] # or list of sets
  mylist=[x for x in s[y] for y in range(depth)]
  &gt; y undefined (error - apologize for inexact error message)
  </code></pre>
  
  <p>Is it possible to achieve this in list-comprehension?</p>
  
  <p>Main question ends here.</p>
  
  <hr>
  
  <p>More on the errors,</p>
  
  <p>Instead of syntax error, I also get <code>name y not defined</code>.</p>
  
  <p>So I tried <code>y=0</code> before the list-comprehension. And it worked! No more name error. Except, it wasn't printing out the content of the list, but rather some loopy numbers.</p>
  
  <p>Even tho, what I am trying to do is violating something, python also seems to be acting strangely. Probably a bug.</p>