Multiple Assignment a = b = c

Sven R. Kunze srkunze at mail.de
Tue Feb 16 08:10:26 EST 2016


On 16.02.2016 14:05, Sven R. Kunze wrote:
> Hi Srinivas,
>
> I think the tuple assignment you showed basically nails it.
>
> First, the rhs is evaluated.
> Second, the lhs is evaluated from left to right.
>
> Completely wrong?
>
> Best,
> Sven

As you mentioned swapping. The following two statements do the same (as 
you suggested at the beginning).

a,b=b,a=4,5
(a,b),(b,a)=(4,5),(4,5)

Best,
Sven


More information about the Python-list mailing list