Why not a, b += i, j? (augmented assignment via tuple unpacking)
Grant Edwards
grante at visi.com
Tue Nov 26 16:46:33 EST 2002
In article <as0p9f$3c7$1 at ginger.mathworks.com>, Joshua Marshall wrote:
>>> but the following is not legal:
>>>
>>> a, b += i, j
>>>
>>> Is there a reason that allowing this would be bad?
>
>> If it were allowed, what do you propose it would do?
>
> Maybe:
>
> a, b += i, j
>
> is equivalent to
>
> tmp = j
> a += i
> b += tmp
To me, that would be a bit counter-intuitive, since
((a,b) + (i,j)) equals (a,b,i,j) rather than ((a+i),(b+j))
--
Grant Edwards grante Yow! I decided to be JOHN
at TRAVOLTA instead!!
visi.com
More information about the Python-list
mailing list