[issue30729] Swap doesn't work in some circumstances

2017-06-21 Thread Raymond Hettinger
Raymond Hettinger added the comment: This is the expected behavior. The assignments are made left-to-right. The first use of L2[1] is updated BEFORE the second use as index. The assignments are equivalent to: == >>> L1 = [1,3,2,4] >>> L2 = [1,3,2,4] >>> tup = L2[L

[issue30729] Swap doesn't work in some circumstances

2017-06-21 Thread Hang Liao
New submission from Hang Liao: Suppose I have two lists L1 = [1,3,2,4], L2 = [1,3,2,4] L1[1], L1[2] = L1[2], L1[1] This gives me L1 = [1,2,3,4] However, if I write L2[1], L2[L2[1] - 1] = L2[L2[1] - 1], L2[1] This gives me back the same L2 = [1,3,2,4] I am not sure if this is a mistake ... If it