[issue28594] List define and Change result

2016-11-03 Thread saeed
saeed added the comment: OK, I found My problem, Thank so much, There is any way to define them shortly?? -- ___ Python tracker ___

[issue28594] List define and Change result

2016-11-03 Thread Xiang Zhang
Xiang Zhang added the comment: In your last example, after x=y=[], you reassign a new list to y, so x and y are different. In your my.py, you are altering the same list. Please read the link Martin gives. -- nosy: +xiang.zhang status: open -> closed ___

[issue28594] List define and Change result

2016-11-03 Thread saeed
Changes by saeed : -- status: closed -> open ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.pytho

[issue28594] List define and Change result

2016-11-03 Thread saeed
saeed added the comment: Thank for attention,but see this: >>> x=y=[] >>> x=y=[0]*3 >>> x [0, 0, 0] >>> y [0, 0, 0] >>> y=[0, 1, 1] >>> x [0, 0, 0] >>> y [0, 1, 1] >>> y[1]+=1 >>> y [0, 2, 1] >>> x [0, 0, 0] >>> x[0]+=5 >>> x [5, 0, 0] >>> y [0, 2, 1] then must my code work and there is another

[issue28594] List define and Change result

2016-11-03 Thread Martin Panter
Martin Panter added the comment: I haven’t looked at your code, but I think you may have misunderstood how variable assignments work in Python. See . When you assign an object such as [0, 0] to a varia

[issue28594] List define and Change result

2016-11-03 Thread saeed
New submission from saeed: Hi, I define multi List in a line such as this: smoke= exercise = cholesterol = angina = stroke = attack = [0] * 2 and This work bad! if I define later line such this, problem has been solve: smoke=[0]*2 exercise = [0]*2 cholesterol = [0]*2 angina