[issue14719] Lists: [[0]*N]*N != [[0 for _ in range(N)] for __ in range(N)]

2012-05-03 Thread Darrell Long
Changes by Darrell Long : -- type: -> behavior ___ Python tracker <http://bugs.python.org/issue14719> ___ ___ Python-bugs-list mailing list Unsubscri

[issue14719] Lists: [[0]*N]*N != [[0 for _ in range(N)] for __ in range(N)]

2012-05-03 Thread Darrell Long
New submission from Darrell Long : N = 5 board_1 = [[0 for _ in range(N)] for __ in range(N)] is not the same as: board_2= [[0]*N]*N One makes a proper list of lists (the first), the second makes a new kind of animal were board_2[1][1] = 99 changes a whole column. Oddly, testing board_1