Assignment target contains multiple star expressionsPYL-E0112
More than one starred expression is being used in assignment. This is a SyntaxError
.
Python allows a tuple or a list of variables to appear on the left side of an assignment operation. Each variable in the tuple receives one value (or more, if we use the * operator) from an iterable on the right side of the assignment.
The * operator collects or pack multiple values in a single variable. Consider the following snippet:
*a, = 1, 2, 3
print(a) # Output = [1, 2, 3]
Here we pack a tuple of values into a single variable a
by using the * operator.
Bad practice
*foo, *bar = [1, 2, 3]
Recommended
*foo, bar = [1, 2, 3]