title: Initialize a 2D Array in a Class in Python
body: <p>I am trying to create a 3x3 Matrix class in python. I am having difficulty initializing the 2D array properly. </p>
  
  <p>In the following code I am getting an error saying that Matrix3x3 has no attribute m. If I initialize m before the <strong>init</strong>, it seems like 'm' acts like a static variable, which I do not want.</p>
  
  <pre><code>class Matrix3x3:
      #[1 0 0]
      #[0 1 0]
      #[0 0 1]
      def __init__(self, m):
          #self.m[row][column]
          self.m[0][0] = m[0][0];
          self.m[0][1] = m[0][1];
          self.m[0][2] = m[0][2];
  
          self.m[1][0] = m[1][0];
          self.m[1][1] = m[1][1];
          self.m[1][2] = m[1][2];
  
          self.m[2][0] = m[2][0];
          self.m[2][1] = m[2][1];
          self.m[2][2] = m[2][2];
  </code></pre>