title: assigning list comprehensions, differences
body: <p>Ok guys, I don't use python all that often (yet), and I kinda dived into it hands on.</p>
  
  <p>Can anyone explain what is going on, so I can read about it?
  Also, if you think my code can be simplified, please comment on this.</p>
  
  <p>I'm trying to make all combinations of each element from two lists, and then adding 2 set variables to each combination.</p>
  
  <pre><code>&gt;&gt;&gt; import itertools
  &gt;&gt;&gt; a = ['topic1', 'topic2']
  &gt;&gt;&gt; b = [{'key':'value'},{'key2':'value2'}]
  &gt;&gt;&gt; c = list(itertools.product(a,b))   
  &gt;&gt;&gt; c
  [('topic', {'key': 'value'}), ('topic', {'key2': 'value2'}), ('topic2', {'key': 'value'}), ('topic2', {'key2': 'value2'})]
  </code></pre>
  
  <p>I need to make lists, however, to be able to extend them in the following step, so:</p>
  
  <pre><code>&gt;&gt;&gt; c = [list(tup) for tup in (itertools.product(a,b))]
  &gt;&gt;&gt; c
  [['topic', {'key': 'value'}], ['topic', {'key2': 'value2'}], ['topic2', {'key': 'value'}], ['topic2', {'key2': 'value2'}]]
  
  &gt;&gt;&gt; d = [2, "/some/folder"]
  &gt;&gt;&gt; e = [x.extend(d) for x in c]
  &gt;&gt;&gt; e 
  [None, None, None, None]
  </code></pre>
  
  <p>What is going on here exactly? Why is e returning None? I can make it work by just evaluating the list comprehension, without assigning it. How come I could assign my list comprehension in c = (tup for tup ...) but not in e?</p>
  
  <pre><code>&gt;&gt;&gt; [tuple(x) for x in c]
  [('topic', {'key': 'value'}, 2, '/some/folder/'), ('topic', {'key2': 'value2'}, 2, '/some/folder/'), ('topic2', {'key': 'value'}, 2, '/some/folder/'), ('topic2', {'key2': 'value2'}, 2, '/some/folder/')]
  &gt;&gt;&gt; c
  [['topic', {'key': 'value'}, 2, '/some/folder/'], ['topic', {'key2': 'value2'}, 2, '/some/folder/'], ['topic2', {'key': 'value'}, 2, '/some/folder/'], ['topic2', {'key2': 'value2'}, 2, '/some/folder/']]
  </code></pre>