tt = a, b = t

Martin v. Loewis martin at v.loewis.de
Sun Jan 13 16:42:57 EST 2002


rihad <rihad at mail.ru> writes:

> tup = 1, 2
> tuptup = a, None = tup
> 
> >>> tup
> (1, 2)
> >>> a
> 1
> >>> tuptup
> (1, 2)
> 
> How did 2 manage to propagate to tuptup through None?

Besides the issue of assigning to None, please notice that the
assignment to tuptup happens *before* the tuple unpacking, see

http://www.python.org/doc/current/ref/assignment.html

# ... and assigns the single resulting object to each of the target
# lists, from left to right.

Regards, 
Martin



More information about the Python-list mailing list