title: Multi-dimensional array is entirely (aside the first value) set to appended value
body: <p>I'm making a function to find all the combinations for a given set of options. When I append a combination as a list to the main list of total combinations (the combinations are indexes, to be taken from the list of options later), all of the existing lists are changed to the list I just appended, apart from the first.</p>
  
  <pre><code>def allCombos(opts):
      limit = len(opts) - 1
      combos = []
      for n in range(1, 3):
          combo = [0] * n
          print(combo) # going to remove this
          goal = [limit] * n
          pointer = 0
          overflowed = False
          while True:
              if combo[pointer] == limit:
                  pointer += 1
                  overflowed = True
              else:
                  if overflowed:
                      combo[pointer] += 1
                      for i in range(pointer):
                          combo[i] = 0
                      pointer = 0
                      combos.append(combo)
                      print(combo) # I will change this
                  else:
                      combo[pointer] += 1
                      combos.append(combo)
                      print(combo) # and this
              if combo == goal:
                  break
  
  allCombos(["foo", "bar"])
  </code></pre>
  
  <p>outputs</p>
  
  <pre><code>[0]
  [1]
  [0, 0]
  [1, 0]
  [0, 1]
  [1, 1]
  </code></pre>
  
  <p>whereas</p>
  
  <pre><code>def allCombos(opts):
      limit = len(opts) - 1
      combos = []
      for n in range(1, 3):
          combo = [0] * n
          goal = [limit] * n
          pointer = 0
          overflowed = False
          while True:
              if combo[pointer] == limit:
                  pointer += 1
                  overflowed = True
              else:
                  if overflowed:
                      combo[pointer] += 1
                      for i in range(pointer):
                          combo[i] = 0
                      pointer = 0
                      combos.append(combo)
                      print(combos) # changed
                  else:
                      combo[pointer] += 1
                      combos.append(combo)
                      print(combos) # changed
              if combo == goal:
                  break
      print("\n" + str(combos)) #added
  
  allCombos(["foo", "bar"])
  </code></pre>
  
  <p>outputs</p>
  
  <pre><code>[[1]]
  [[1], [1, 0]]
  [[1], [0, 1], [0, 1]]
  [[1], [1, 1], [1, 1], [1, 1]]
  
  [[1], [1, 1], [1, 1], [1, 1]]
  </code></pre>
  
  <p>This seems odd, as the only specified modifications of <code>combos</code> seems to be the appending.</p>
  
  <p>I've looked for other questions with similar issues, but I couldn't find any.</p>
  
  <p>Thanks in advance!</p>