The following Code in python:
matrix = [[0]*3]*2 matrix[0][1] = 1
seeems to be changing the value at all the matrix[][1]th pos
matrix[][1]
Try:
matrix = [[0]*3 for j in xrange(2)]