[issue36450] 3D Array Assignment to all 2D sub-arrays

2019-03-27 Thread Eric Snow
Eric Snow added the comment: In Python, multiplication on a list does not make copies of the values in the original list. So what you have done is equivalent to the following: a = [0, 0] b = [a, a] M = [b, b] Hence: >>> M[0] is M[1] True >>> M[0][0] is M[0][1] True >>>

[issue36450] 3D Array Assignment to all 2D sub-arrays

2019-03-27 Thread John Bachman
Change by John Bachman : -- versions: +Python 3.7 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue36450] 3D Array Assignment to all 2D sub-arrays

2019-03-27 Thread John Bachman
New submission from John Bachman : Tested on Python3.6 on Ubuntu 18.04 The following code snippet produces the wrong results. Snippet: M = [[[0] * 2] * 2] * 2 M[0][0][0] = 1