title: Create an Array of objects in Python
body: <p>I'm trying to make a list of objects in python. I'm doing this by making one object and appending it. Here is my code. </p>
  
  <pre><code>#Creating a Python object
  class TestDat(object):
       Dat1 = None
       Dat2 = None
  #Declaring the Test Array
  TestArray = []
  #Declaring the object
  Test1 = TestDat()
  #Defining the member variables in said object
  Test1.Dat1 = 0
  Test1.Dat1 = 1
  #Appending the object to the List
  TestArray.append(Test1)
  #Rewriting and appending again
  Test1.Dat1 = 3
  Test1.Dat1 = 4
  TestArray.append(Test1)
  #Printing our Our Results
  print TestArray[0].Dat1
  print TestArray[1].Dat1
  </code></pre>
  
  <p>When I test it out. I get the output "4 4". This means that both elements of the list are the same. It seems like append is just copying a pointer to the object instead of a copy of said object. I would eventually like to do this in a loop so I can't be doing that. How can I get both elements of the List to be different without using a new object?</p>