title: Python elements retrieved from container (list, dict, tuple etc) passed by reference or value?
body: <p>I have a function that updates data in a cache (implemented as a dictionary).</p>
  
  <pre><code>def updateCache(name, new_data):
      global cache
      info = cache[name]  # is this being passed to me as a val or ref?
      datarows = info['datarows']
      datarows.append(new_data)
  
      # These will not be necessary if I was dealing with references ...?
      # or in other words, are the following statements redundant or required?
      info['datarows'] = datarows
      cache[name] = info
  </code></pre>
  
  <p>As the comment in the snippet enquires, do I need to stick the new updated objects back into the cache, or am I dealing with references to the objects stored in the dict - in which case the last two statements are redundant?</p>