>>> lis = [5,6,7,10,11,12]
>>> lis[0], lis[-1] = lis[-1], lis[0]
>>> lis
[12, 6, 7, 10, 11, 5]
Order of evaluation of the above expression:
expr3, expr4 = expr1, expr2
First items on RHS are collected in a tuple, and then that tuple is unpacked and assigned to the items on the LHS.
>>> lis = [5,6,7,10,11,12]
>>> tup = lis[-1], lis[0]
>>> tup
(12, 5)
>>> lis[0], lis[-1] = tup
>>> lis
[12, 6, 7, 10, 11, 5]
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…