[issue29584] 2D list with Bugs when defined by using Multiplication

2017-02-16 Thread Ezio Melotti
Ezio Melotti added the comment: Not a bug, see https://docs.python.org/3/faq/programming.html#how-do-i-create-a-multidimensional-list and https://docs.python.org/3/faq/programming.html#why-did-changing-list-y-also-change-list-x -- assignee: -> ezio.melotti nosy: +ezio.melotti resolut

[issue29584] 2D list with Bugs when defined by using Multiplication

2017-02-16 Thread Yaowei Zhang
New submission from Yaowei Zhang: #If we define a list by: nums = [[0]*3]*3 #nums = [[0,0,0],[0,0,0],[0,0,0]] nums[0][1] = 1 print(mums) # the result is [[0,1,0],[0,1,0],[0,1,0]] #I think it is because all the line use the same list variable, but it suppose #not. -- components: +Build -

[issue29584] 2D list with Bugs when defined by using Multiplication

2017-02-16 Thread Yaowei Zhang
Changes by Yaowei Zhang : -- components: Library (Lib) nosy: Yaowei Zhang priority: normal severity: normal status: open title: 2D list with Bugs when defined by using Multiplication versions: Python 3.5 ___ Python tracker