Why not a, b += i, j? (augmented assignment via tuple unpacking)

Greg Ewing see_reply_address at something.invalid
Tue Nov 26 23:49:59 EST 2002


Jeff Epler wrote:

> but in that case, what is
>     a, b += t
> equivalent to?


Obviously it's

    a, b = iadd(a, t[0]), iadd(a, t[1])

> What about
>     t += a, b


This is already meaningful:

    t = iadd(t, (a, b))

-- 
Greg Ewing, Computer Science Dept,
University of Canterbury,	
Christchurch, New Zealand
http://www.cosc.canterbury.ac.nz/~greg




More information about the Python-list mailing list