[issue39118] Variables changing values on their own

2019-12-22 Thread Terry J. Reedy
Terry J. Reedy added the comment: Leonardo, even if this were a bug, it would be a mistake to ascribe it to IDLE. The IDLE Shell is an alternative display window. IDLE sends your code to Python and displays values computed by Python and output by print statements. I second Mark's suggestio

[issue39118] Variables changing values on their own

2019-12-22 Thread Mark Dickinson
Mark Dickinson added the comment: This isn't a bug. After this line in your code: o = x both o and x refer to the same list object. So any modification you make to that list through the name "x" (for example, x[i][n]+=y[i][n]) will be seen through the name "o" as well. There's lots writ

[issue39118] Variables changing values on their own

2019-12-22 Thread Leonardo
New submission from Leonardo : in this code the variable o changes on its own: x=[[-1, 7, 3], [12, 2, -13], [14, 18, -8], [17, 4, -4]] x1=[[-8, -10, 0], [5, 5, 10], [2, -7, 3], [9, -8, -3]] y=[[0,0,0],[0,0,0],[0,0,0],[0,0,0]] k=True f=0 z=[] d=[] while k: print(k) o=x print(o) f