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

2012-05-04 Thread Yuval Greenfield
Yuval Greenfield ubershme...@gmail.com added the comment: This isn't a bug and should be closed. It's more of a stack overflow question. If you'd like to change this fundamental behavior of a very common operation in python you should make a proposal to the python ideas mailing list at

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

2012-05-04 Thread Martin v . Löwis
Martin v. Löwis mar...@v.loewis.de added the comment: It's actually fairly easy to explain. Just think about it harder (and consider Yuval's explanation). -- nosy: +loewis resolution: - invalid status: open - closed ___ Python tracker

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

2012-05-04 Thread Ezio Melotti
Ezio Melotti ezio.melo...@gmail.com added the comment: http://docs.python.org/faq/programming.html#how-do-i-create-a-multidimensional-list http://python.net/crew/mwh/hacks/objectthink.html -- nosy: +ezio.melotti stage: - committed/rejected ___

[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 darr...@cs.ucsc.edu: 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,

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

2012-05-03 Thread Darrell Long
Changes by Darrell Long darr...@cs.ucsc.edu: -- type: - behavior ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14719 ___ ___ Python-bugs-list