More generally speaking, a commatized list of l-values used as an l-value in Python unpacks an iterable from the right-hand side into the parts of the left-hand side.
In your case, this means that the right-hand side creates a three-tuple of the values cur+old
, cur
and i+1
, which is then unpacked into cur
, old
and i
, respectively, so that it is the same as saying:
old = cur
cur = cur + old
i = i + 1
However, it is more useful, since cur
isn't clobbered before old
has been assigned to. It can also be used much more generally -- the left-hand side can consist of any l-values and the right-hand side can be any iterable, and you can do things like these:
a, b, c = range(3)
or
d = [0] * 10
d[3], d[7] = 1, 2
or
e, f, g = d[2:5]
In Python3, you can also used asterisk expressions to unpack "the rest" of an iterable; for instance, like this
h, *i, j = range(5)
# h will be 0, j will be 4, and i will be [1, 2, 3]
That doesn't work in Python2, however.
For the details, this is covered in section 7.2 of the language reference.