title: Initializing 2d list in Python provides links between values (same address)
body: <p>I need to initialize 2d array with list.<br>
  For example 2X3 array: <code>[[0,0,0], [0,0,0]]</code></p>
  
  <p>First attempt:  </p>
  
  <pre><code>In: a1 = [[0]*3]*2
  In: a1[0][0] = 100
  In: a1
  Out: [[100,0,0], [100,0,0]]
  </code></pre>
  
  <p>This is strange. So I checked:</p>
  
  <pre><code>In: a1 = [[0]*3]*2
  In: id(a1[0][0])
  Out: 4518461984
  In: id(a1[1][0])
  Out: 4518461984
  </code></pre>
  
  <p>Same address.</p>
  
  <p>Second attempt:</p>
  
  <pre><code>In: a2 =[[0]*3 for i in range(2)]
  In: a2[0][0] = 100
  In: a2
  Out: [[100, 0, 0], [0, 0, 0]]
  </code></pre>
  
  <p>Right.</p>
  
  <p>Let me check memory address again:</p>
  
  <pre><code>In: a2 =[[0]*3 for i in range(2)]
  In: id(a2[0][0])
  Out: 4518461984
  In: id(a2[1][0])
  Out: 4518461984
  </code></pre>
  
  <p>Well, strange. Same address again. I expected different addresses. My initial guess is that the address returned is the address of pointer to value. Then how can I retrieve the address of the slot?</p>
  
  <p>Is there anyone who can explain the workings of Python that caused this behavior? In Python, I think it's very hard to know which is pointer and which is value.</p>