title: Python2.7: Ensure 3D list of objects are unique
body: <p>I'm using a 3D list of objects in Python to organize a data set that I have. I'm noticing that my object elements are not quite unique i.e. variables inside one object of the array are being updated in others. A minimal working example that illustrates my issue is shown below.</p>
  
  <pre><code>class myClass:
          def __init__(self,ListA=[],ListB=[],ListCount=0):
                  self.ListA = ListA
                  self.ListB = ListB
                  self.ListCount = ListCount
  
          def add_data(self,ElementA,ElementB):
                  self.ListA.append(ElementA)
                  self.ListB.append(ElementB)
                  self.ListCount = self.ListCount + 1
  
          def check_data(self):
                  if(len(self.ListA) != self.ListCount):
                          print("Error: Unaccounted for Data in Object!")
                          print("Object has %d elements. Thinks it has %d"%(len(self.ListA),self.ListCount))
  </code></pre>
  
  <p>The python code that uses this class definition goes something like this.</p>
  
  <pre><code>import random
  
  ObjectArray = [[[myClass() for k in range(4)] for j in range(3)] for i in range(2)]
  #Print addresses of object array
  print("Addresses of the individual object elements in the 3D list ")
  for i in range(0,2):
          for j in range(0,3):
                  for k in range(0,4):
                          print(ObjectArray[i][j][k])
  
  #Loop over object array and fill each object with some data
  for i in range(0,2):
          for j in range(0,3):
                  for k in range(0,4):
  
                          NumData = int(10*random.random())
  
                          for m in range(0,NumData):
  
                                  #Generate some junk data to insert into the list of this object
                                  ListAData = int(10*random.random())
                                  ListBData = int(10*random.random())
  
                                  ObjectArray[i][j][k].check_data()
                                  ObjectArray[i][j][k].add_data(ListAData,ListBData)
                                  ObjectArray[i][j][k].check_data()
  </code></pre>
  
  <p>What have I missed? Is it possible to use 3D lists of objects in Python 2.7? Each object in the list appears to have a unique memory address when I print it out. Any insight would be greatly appreciated.</p>
  
  <p>A sample of the output from this code is:</p>
  
  <pre><code>Addresses of the individual object elements in the 3D list 
  &lt;__main__.myClass instance at 0x7fc59ad4ef80&gt; &lt;__main__.myClass
   instance at 0x7fc59ad635a8&gt; &lt;__main__.myClass instance at
   0x7fc59ad63248&gt; &lt;__main__.myClass instance at 0x7fc59ad63440&gt;
   &lt;__main__.myClass instance at 0x7fc59ad6d320&gt; &lt;__main__.myClass
   instance at 0x7fc59ad6d368&gt; &lt;__main__.myClass instance at
   0x7fc59ad6d3b0&gt; &lt;__main__.myClass instance at 0x7fc59ad6d3f8&gt;
   &lt;__main__.myClass instance at 0x7fc59ad6d488&gt; &lt;__main__.myClass
   instance at 0x7fc59ad6d4d0&gt; &lt;__main__.myClass instance at
   0x7fc59ad6d518&gt; &lt;__main__.myClass instance at 0x7fc59ad6d560&gt;
   &lt;__main__.myClass instance at 0x7fc59ad6d638&gt; &lt;__main__.myClass
   instance at 0x7fc59ad6d680&gt; &lt;__main__.myClass instance at
   0x7fc59ad6d6c8&gt; &lt;__main__.myClass instance at 0x7fc59ad6d710&gt;
   &lt;__main__.myClass instance at 0x7fc59ad6d7a0&gt; &lt;__main__.myClass
   instance at 0x7fc59ad6d7e8&gt; &lt;__main__.myClass instance at
   0x7fc59ad6d830&gt; &lt;__main__.myClass instance at 0x7fc59ad6d878&gt;
   &lt;__main__.myClass instance at 0x7fc59ad6d908&gt; &lt;__main__.myClass
   instance at 0x7fc59ad6d950&gt; &lt;__main__.myClass instance at
   0x7fc59ad6d998&gt; &lt;__main__.myClass instance at 0x7fc59ad6d9e0&gt; 
  Error: Unaccounted for Data in Object! Object has 4 elements. Thinks it has 0
  Error: Unaccounted for Data in Object! Object has 5 elements. Thinks it has 1 
  Error: Unaccounted for Data in Object! Object has 5 elements. Thinks it has 1 
  Error: Unaccounted for Data in Object! Object has 6 elements. Thinks it has 2 
  Error: Unaccounted for Data in Object! Object has 6 elements. Thinks it has 2 
  Error: Unaccounted for Data in Object! Object has 7 elements. Thinks it has 3 
  Error: Unaccounted for Data in Object! Object has 7 elements. Thinks it has 3 
  </code></pre>