```
def swapPairs(self, head):
cur = dummy = ListNode(0)
cur.next = head
while cur.next and cur.next.next:
cur.next.next.next, cur.next.next, cur.next, cur = \
cur.next, cur.next.next.next, cur.next.next, cur.next
return dummy.next
```

[updated thanks to Stefan!]

"A,B,C = X,Y,Z" is very powerful in linked list problem. Notice that in this solution, the order has to be "cur.next.next.next, cur.next.next, cur.next, cur". It would be nice to evaluate the farest variable first, while the path to that variable hasn't been changed.

[old post]

"A,B,C = X,Y,Z" is very powerful in linked list problem. Notice that in this solution, the order has to be "cur.next.next.next, cur.next.next, cur.next, cur"

I am not an expert in python, my understanding of python's processing of "A,B,C = X,Y,Z" is

- Freeze A, B, C. If X, Y, Z depend on A, B, C, they are processed with frozen A, B, C
- Process sequentially, A, B, then C
- If B depends on A, then change of A will affect B -- a easy way is to put B ahead of A

Based on (3), "cur.next.next.next, cur.next.next, cur.next, cur" is the right order to process.