Python

Python

Made by DeepSource

Invalid star assignment target PYL-E0113

Bug risk
Major
Autofix

A star expression is being used as a starred assignment target. In order to do that, the starred assignment target must be in a list or tuple, otherwise Python will throw a SyntaxError.

Bad practice

*var = [1, 2, 3, 4]  # SyntaxError

Recommended

(*var,) = [1, 2, 3, 4]

# This is also valid
foo, *var = [1, 2, 3, 4]