Fix is sometimes available.
What it does#
Checks for uses of the
+ operator to concatenate collections.
Why is this bad?#
In Python, the
+ operator can be used to concatenate collections (e.g.,
x + y to concatenate the lists
However, collections can be concatenated more efficiently using the
unpacking operator (e.g.,
[*x, *y] to concatenate
Prefer the unpacking operator to concatenate collections, as it is more
readable and flexible. The
* operator can unpack any iterable, whereas
+ operates only on particular sequences which, in many cases, must be of
the same type.