Why not a, b += i, j? (augmented assignment via tuple unpacking)
Joshua Marshall
jmarshal at madmax.mathworks.com
Wed Nov 27 09:46:28 EST 2002
John Roth <johnroth at ameritech.net> wrote:
> I'd think it would be equivalent to:
> a += i
> b += j
> the corner case you mention should behave
> the same as
> a, b = b, a
> Why make it more complicated than it has
> to be?
Because if you do the translation with your rule, you get:
a += b
b += a
which is, in my opinion, unexpected.
More information about the Python-list
mailing list