> I initialize them by putting None along all the fields 

Actually you don't.

    def initialize(self):
        self.buttonmatrix=[]
        self.statematrix=[]
        self.bombmatrix=[]

3 empty lists, so far so good.

        for i in range(self.fil):
            aux=[]
            for j in range(self.col):
                aux.append(None)

a new list filled with None

            self.buttonmatrix.append(aux)
            self.bombmatrix.append(aux)
            self.statematrix.append(aux)

THat same list inserted into all three lists, so they all point 
at the same internal list of Nones. So when you change one, 
you change all.

Try using aux[:] instead to take a copy of aux...
You could also use list comprehension instead of the loop/append:

aux = [None for i in range(self.col)]


HTH,

Alan G.
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to