On 5/25/07, Matt Smith <[EMAIL PROTECTED]> wrote:
> def update_matrix(matrix):
> matrix_updated = matrix
That line assigns the name matrix_updated to the same list-of-lists as
matrix. Since lists are mutable objects, changing matrix_updated is
also changing matrix. What you need is to bind matrix_updated to a
new copy of matrix instead.
At the top of your code add:
from copy import deepcopy
and replace the first line of update_matrix() with:
matrix_updated = deepcopy(matrix)
After making that change, your code appears to run beautifully!
--
Jerry
_______________________________________________
Tutor maillist - [email protected]
http://mail.python.org/mailman/listinfo/tutor