Ohh, I never thought it this way. Thanks for enlightening.

On Sun, Nov 22, 2009 at 9:52 PM, Alan Gauld <alan.ga...@btinternet.com>wrote:

>
> "Lie Ryan" <lie.1...@gmail.com> wrote
>
>
> I was a bit surprised this doesn't work though:
>
>>
>> a, b += k, k
>>
>>
> What would you expect?
> Remember that
>
> a,b = c,d
>
> is just tuple assignment without using parens (and parens are not part of
> the tuple definition)
>
> So using tuples
>
> a,b += k,k
>
> would unwrap as
>
> a,b = (a,b) + (k,k)   -> (a,b,k,k)
>
> which should give an error since we are then unpacking 4 values
> into two...
>
> It doesn't really make sense.
>
> --
> Alan Gauld
> Author of the Learn to Program web site
> http://www.alan-g.me.uk/
>
> _______________________________________________
> Tutor maillist  -  Tutor@python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to