Everytime you do a in <iterable>
statement, it fetches one item from the iterable and then unpacks it according to your needs, in your case b, c
. So, in the first example, you try to assign b, c
to 1
which is not possible, whereas in next example you do b, c = (1, 2)
which unpacks successfully and gives you a b, c.
For example, try to print out the values.
>>> for x in [1, 2]:
print "X: ", x
X: 1
X: 2
>>> for x in [(1, 2)]:
print "X: ", x
X: (1, 2)
So, assigning b, c = 1
is not possible, whereas assigning b, c = (1, 2)
is possible.