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

Grant Edwards grante at visi.com
Tue Nov 26 16:01:29 EST 2002


In article <KbRE9.534$RQ3.26615908 at newssvr17.news.prodigy.com>, Steven Rumbalski wrote:

> In python I can write:
> 
> a, b = i, j
> 
> 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?

> Why does Python forbid this?

First tell us what you think it would do were it legal.  :)

-- 
Grant Edwards                   grante             Yow!  Now, I think it would
                                  at               be GOOD to buy FIVE or SIX
                               visi.com            STUDEBAKERS and CRUISE for
                                                   ARTIFICIAL FLAVORING!!



More information about the Python-list mailing list