title: Adding elements to a 3d array in python
body: <p>I am new to Python and I am trying to add elements to a 3D list. </p>
  
  <pre><code>def getHoughSpace(self):
          space = [[[]]]
          for i in range(0, len(self.xs)):
              rho = self.getRho(self.xs[i], self.ys[i], self.zs[i])
              space.append([Cell(rho, 0)])
              for j in range(0, len(self.ys)):
                  theta = self.getTheta(self.xs[j], self.ys[j], self.zs[j])
                  space[i].append([Cell(theta, 0)])
                  for k in range(0, len(self.zs)):
                      phi = self.getPhi(self.xs[k], self.ys[k])
                      space[i][j].append([Cell(phi, 0)]) # error happens here
  </code></pre>
  
  <p>However, when <code>i=1</code>, <code>j=0</code>, and <code>k=0</code>, my program crashes with the error:</p>
  
  <pre><code>AttributeError: Cell instance has no attribute 'append'
  </code></pre>
  
  <p>Why is this happening? How can I get passed <code>i=0</code>, <code>j=0</code>, and <code>k=0</code> but not when <code>i=1</code>? Obviously, I am accessing a Cell at <code>space[i][j]</code>, but I want to access the list of <code>Cells</code>.</p>
  
  <ul>
  <li>An interesting note is that if I comment out the error line, it runs. So why does the problem occur only in the 3rd dimension?</li>
  </ul>