title: Filling the matrix with namedtuples
body: <p>Why is the matrix filled with namedtuples like this?</p>
  
  <p>Incorrectly inserted indexes</p>
  
  <p>And how to fix it?</p>
  
  <pre><code>from collections import namedtuple
  
  Point = namedtuple('Point', ['x', 'y'])
  m, n = 3, 3
  matrix = [[None] * n] * m
  for i in range(m):
      for j in range(n):
          matrix[i][j] =  Point(i, j)
  for row in matrix:
      print(row)
  
  #&gt;&gt;Output
  #[Point(x=2, y=0), Point(x=2, y=1), Point(x=2, y=2)]
  #[Point(x=2, y=0), Point(x=2, y=1), Point(x=2, y=2)]
  #[Point(x=2, y=0), Point(x=2, y=1), Point(x=2, y=2)]
  </code></pre>
  
  <p>The result should be</p>
  
  <pre><code>#&gt;&gt;Output
  #[Point(x=0, y=0), Point(x=0, y=1), Point(x=0, y=2)]
  #[Point(x=1, y=0), Point(x=1, y=1), Point(x=1, y=2)]
  #[Point(x=2, y=0), Point(x=2, y=1), Point(x=2, y=2)]
  </code></pre>