title: Python's hasattr on list values of dictionaries always returns false?
body: <p>I have a dictionary that sometimes receives calls for non-existent keys, so I try and use <code>hasattr</code> and <code>getattr</code> to handle these cases:</p>
  
  <pre><code>key_string = 'foo'
  print "current info:", info
  print hasattr(info, key_string)
  print getattr(info, key_string, [])
  if hasattr(info, key_string):
      array = getattr(info, key_string, [])
  array.append(integer)
  info[key_string] = array
  print "current info:", info
  </code></pre>
  
  <p>The first time this runs with <code>integer = 1</code>:</p>
  
  <pre><code>current info: {}
  False
  []
  current info: {'foo': [1]}
  </code></pre>
  
  <p>Running this code again with <code>integer = 2</code>:</p>
  
  <pre><code>instance.add_to_info("foo", 2)
  
  current info: {'foo': [1]}
  False
  []
  current info: {'foo': [2]}
  </code></pre>
  
  <p>The first run is clearly successful (<code>{'foo': [1]}</code>), but <code>hasattr</code> returns false and <code>getattr</code> uses the default blank array the second time around, losing the value of <code>1</code> in the process! Why is this?</p>