we have:

enter image description here

what does pa, pb = pb, pa mean? Help me to understand this.

1 Answer 1


The code pa, pb = pb, pa swaps the values stored in pa and pb

It's a faster way of writing something like:

temp = pa
pa = pb
pb = temp
  • suppose pa = x, pb = y, then its says pb = pb means y = y, then pa, how it is swapping? i did not understand.
    – Hacek
    Commented Apr 8, 2023 at 16:08
  • Here is a similar stackoverflow question with a more detailed answer: stackoverflow.com/questions/14836228/…
    – pacrob
    Commented Apr 9, 2023 at 18:18

Not the answer you're looking for? Browse other questions tagged or ask your own question.