title: Python: append an original object vs append a copy of object
body: <p>First of all, sorry if this questions is extremely basic, I'm just starting with Python. </p>
  
  <p>I'm having problems understanding how Python 3.6 creates and appends objects to lists. See the following code:</p>
  
  <pre><code>a_dict=dict()
  a_list=list()
  
  for i in range(100):
    a_dict['original'] = i
    a_dict['multi'] = i*2
    a_list.append(a_dict)
  </code></pre>
  
  <p>The print of the list goes like</p>
  
  <pre><code>print(a_list)
  &gt;&gt;[{'original': 99, 'multi': 198}{'original': 99, 'multi': 198}...{'original': 99, 'multi': 198}]
  </code></pre>
  
  <p>According to my original thoughts, i=0 -> original=0, multi=0; i=1 -> original=1, multi=2; etc...</p>
  
  <p>But, according to this question <a href="https://stackoverflow.com/questions/5244810/python-appending-a-dictionary-to-a-list-i-see-a-pointer-like-behavior">here</a>, Python's append() appends a pointer to the object not the actual value. So I change the append(original) on my original code to append(copy):</p>
  
  <pre><code>a_dict=dict()
  a_list=list()
  
  for i in range(100):
    a_dict['original'] = i
    a_dict['multi'] = i*2
    a_list.append(a_dict.copy()) ##change here
  </code></pre>
  
  <p>Now, I get the desired result:</p>
  
  <pre><code>print(a_list)
  [{'original': 0, 'multi': 0}, {'original': 1, 'multi': 2}, {'original': 2, 'multi': 4},...]    
  </code></pre>
  
  <p>Now, here is my question:</p>
  
  <p>How append() really works? Do always lists contain pointers-like objects to their originals? How about other types? Should I always use copy() if my intentions are not to directly mess with the original values or the list/container I'm using?</p>
  
  <p>Hope I'm explaining myself good enough. And again sorry if it's a basic question. Thanks.</p>