Python - Multiple-Target Assignments

Introduction

A multiple-target assignment assigns all the given names to the object all the way to the right.

The following code assigns the three variables a, b, and c to the string 'test':

Demo

a = b = c = 'test' 
print( a, b, c )

Result

This form is equivalent to (but easier to code than) these three assignments:

c = 'test' 
b = c 
a = b 

Related Topic