title: append to list in defaultdict
body: <p>I'm trying to append objects to lists which are values in a defaultdict:</p>
  
  <pre><code>dic = defaultdict(list)
  groups = ["A","B","C","D"]
  
  # data_list is a list of objects from a self-defined class. 
  # Among others, they have an attribute called mygroup
  
  for entry in data_list:
      for mygroup in groups:
          if entry.mygroup == mygroup:
              dic[mygroup] = dic[mygroup].append(entry)
  </code></pre>
  
  <p>So I want to collect all entries that belong to one group in this dictionary, using the group name as key and a list of all concerned objects as value. </p>
  
  <p>But the above code raises an AttributeError:</p>
  
  <pre><code>    dic[mygroup] = dic[mygroup].append(entry)
  AttributeError: 'NoneType' object has no attribute 'append'
  </code></pre>
  
  <p>So it looks like for some reason, the values are not recognized as lists?</p>
  
  <p>Is there a way to append to lists used as values in a dictionary or defaultdict?
  (I've tried this with a normal dict before, and got the same error.)</p>
  
  <p>Thanks for any help!</p>