Talk:Euclidean algorithm (Python)
Nice article - how can I understand the body of the while loop - namely:
a, b = b%a, a
What is that construct called? I would like to figure that out.
This is multiple assignment. var a becomes b%a ; then b adopts the stale value of a. The C implementation of gcd() uses a temporary value to swap the values in an order that doesn't overwrite either one prematurely. Python's runtime handles that here for us.
Also, this explanation is so stilted I barely believe it isn't from an unattributed textbook. --Nzen :: 1 June 14hijackerhijacker